473,671 Members | 2,382 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

2 New Member
How to Add 2 Numbers ?
Sep 9 '07 #1
6 1878
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 'ClassCastExcep tions' 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
2044
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. My test program as follows: ----------------------------------------------------------------- #include <ncurses.h> #define sleep(x) usleep(x * 1000) // adjust sleep functions to
4
1292
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
4125
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 for float()" " here's the code ************
14
8652
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, but we started facing issues once we go above 15 digits. Thanks, Venkat
0
8481
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8400
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8823
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8672
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5702
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4227
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4412
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2817
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 we have to send another system
2
1814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.