java prg

java prg

how to write a program in java for add two number without using increment and arithmetic operator.

View Answers

July 25, 2011 at 10:40 AM

import java.math.*;
class AddNumbers 
{
    public static void main(String[] args) 
    {
        BigInteger num1=new BigInteger("100");
        BigInteger num2=new BigInteger("50");
        BigInteger result=num1.add(num2);
        System.out.println(result);
    }
}

July 25, 2011 at 10:41 AM

public class AddNumberUsingBitwiseOperators {
    public static void main(String[] args) {
        System.out.println("Adding 5 and 6......");
        int x=5,y=6;
        int xor, and, temp;
        and = x & y;
        xor = x ^ y; 

        while(and != 0 ){
            and <<= 1; 
            temp = xor ^ and;
            and &= xor; 
            xor = temp; 
        }
        System.out.println(xor);
        }
        }









Related Tutorials/Questions & Answers:
java prg
java prg  how to write a program in java for add two number without using increment and arithmetic operator.   import java.math.*; class AddNumbers { public static void main(String[] args
prg
Advertisements
ModuleNotFoundError: No module named 'prg'
ModuleNotFoundError: No module named 'prg'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'prg' How to remove the ModuleNotFoundError: No module named 'prg' error
File Handling - Java Beginners
File Handling  Q. Write a java prg which accepts a list of existing... the existing prg import java.io.*; class FileCopy { public static void main(String...(e.getMessage()); } } }   its prg of copying file Check code
How to use Java Beans in JSP?
How to use Java Beans in JSP?  Hi, I have developed a employee bean in Java: public class Employee{ private String name; private String code; ..... } Please tell me how I can use Employee Java bean in JSP page? Thanks
FileHandling - Java Beginners
FileHandling  Q. Write a java prg which accepts a list of existing text files from command line args & concatinate contents of all files... prg import java.io.*; class FileConcat { public static void main
servlet program problem - Java Beginners
servlet program problem   i used ur servlet example prg with xml file of helloworld program and i run dat program in tomcat, it shows only the files in my specified directory but when i clicked dat file name it just displaying
javabean in jsp
javabean in jsp  hi.. how to get the table values in jsp using javabean.????? that means i have a html prg that accepts table name and javabean prg... on browser?????   Hi, Please see the example code at Java Bean in JSP page
User defined package problem - Java Beginners
. above prg compiles if We write class B as class B extends A Coming to ur prg...[]) { Public_Demo1 pd=new Public_Demo1(); pd.show(); } } } your prg will compile. you
Graphical calculator using AWT - Java Beginners
..and is it the same code we need implement on Graphical Calc using Swing? Here is the prg code...://www.roseindia.net/java/ Amardeep
series
using any buffered or anything,i want only a simple prg
connect jsp with tomcat - JSP-Servlet
are -> windows vista sp1, ->jdk 6 version (c:/prog~ files/java/jdk.... )(path... web.xml file.. or put your jsp prg folder in jsp-examples only, you can send
programming error
programming error  I got an error when i did the following program the prg. is to "select the name from database when the age is given for the respective name" error i got is:SQL exception please give me the solution by providing
Struts insert & retrieve
Struts insert & retrieve  Give a struts prg to insert and retrieve data from mysql db using the struts tags(no jsp scriplets and expressions) following mvc arch. i.e. model containing db connectivity, form containing get &
java
java  diff bt core java and java
java
java  what is java
JAVA
JAVA  how the name came for java language as "JAVA
java
java   why iterator in java if we for loop
java
java  explain technologies are used in java now days and structure java
java
java  different between java & core java
Java
Java   Whether Java is pure object oriented Language
java
java  is java open source
java
java  what is java reflection
java
java   in java does not pointers concept but what is nullpointers in java?   nullpointer is a runtime Exception
java
what is the size of array in java ?  what is the size of array in java ? what is the mean of finalize in java
java
java  give a simple example for inheritance in java
java
java  why to set classpath in java
java
java  why to set classpath in java
java
java   What is ?static? keyword
java
java  RARP implementation using java socket
java
java  sample code for RARP using java
java
java  Write a java code to print "ABABBABCABABBA
java
java  write a program in java to acess the email
java
java  send me java interview questions
java
java  write a java program using filenotfoundexception
java
java  give a simple example for inheritance in java
java
java  why to set classpath in java
java
java  why to set classpath in java
java
java  Does java allows multiline comments
Java
Java  how to do java in command prompt
java
java  how use java method
java
java  what are JAVA applications development tools
Java
Java   Whether Java is Programming Language or it is SOftware
java
java  is java purely object oriented language
java
java  why multiple inheritance is not possible in java
java
java  explain object oriented concept in java
java
java   difference between class and interface
Java
Java  how to draw class diagrams in java
java
java  hi im new to java plz suggest me how to master java[email protected]
java
java   How to set java Policy for applet using jdk 6

Ads