473,511 Members | 16,730 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to add 2 numbers(integers,floats,..etc. In JAVA language

2 New Member
How to Add 2 Numbers ?
Sep 9 '07 #1
6 1873
pbmods
5,821 Recognized Expert Expert
Heya, Ashok. Welcome to TSDN!

I'm going to go ahead and move this thread to the Java forum, where our resident Experts will be better able to help you out.
Sep 9 '07 #2
Ganon11
3,652 Recognized Expert Specialist
...with the '+' operator?
Sep 9 '07 #3
JosAH
11,448 Recognized Expert MVP
...with the '+' operator?
Java is not C++; Java is much more clumsy than that: the Number class is the
abstract superclass of many classes that implement the 'add' operator but one
has to use the 'instanceof' operator or deal with 'ClassCastExceptions' in order
to just add two Numbers. Don't blame me, I didn' invent that language ;-)

Of course for primitives Java behaves like a full blown programming language and
that '+' operator is implemented for convenience.

kind regards,

Jos
Sep 9 '07 #4
Ganon11
3,652 Recognized Expert Specialist
I simply assumed that, since every other word in the OPs question was capitalized, that his/her question was "How to add 2 numbers," not necessarily referring to any specific class or type, but instead referring to ints, doubles, floats, etc. etc.
Sep 9 '07 #5
pbmods
5,821 Recognized Expert Expert
... and that he posted it in the PHP forum, let's not forget.
Sep 9 '07 #6
ramadeviirrigireddy
54 New Member
How to Add 2 Numbers ?
Here is the code:

<Removed by Admin>
Sep 10 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

5
2038
by: Kenneth Lantrip | last post by:
Im trying to learn a little more about C compilers. Im trying to work with 64 bit numbers (integers) with the gcc compiler in linux (ubuntu). I need to know how to make use of 64 bit numbers. ...
4
1282
JavaStudent07
by: JavaStudent07 | last post by:
File file=new File("H:/Numbers.java"); String Text=""; int intNumber=1; BufferedReader lineIn=new BufferedReader(new FileReader(file)); try { Text=lineIn.readLine(); }
16
4113
by: luca bertini | last post by:
Hi, i have strings which look like money values (ie 34.45) is there a way to convert them into float variables? everytime i try I get this error: "numb = float(my_line) ValueError: empty string...
14
8633
by: thehobbit | last post by:
Hi, Could anyone give ideas on how to add 4 20 digit numbers in ANSI C and pass the result back to a calling program in COBOL? We were able to add up to 15 digit numbers without any problems,...
0
7138
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7355
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7081
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7510
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5668
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3225
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1576
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
781
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.