Ask Experts Questions for FREE Help !
Ask
    sankulanushkul's Avatar
    sankulanushkul Posts: 3, Reputation: 1
    New Member
     
    #1

    Jun 6, 2007, 04:40 AM
    Java code
    Please give me a simple java code for addition of two numbers here two numbers are accepted

    From users please give me explanation about each code
    jstrike's Avatar
    jstrike Posts: 418, Reputation: 44
    Full Member
     
    #2

    Jun 6, 2007, 12:33 PM
    Quote Originally Posted by sankulanushkul
    please give me a simple java code for addition of two numbers here two numbers are accepted

    from users please give me explaination about each code
    Instead of us doing your homework why don't you post some code that you've written and we'll be glad to help you with it.
    naimlatifi's Avatar
    naimlatifi Posts: 26, Reputation: 1
    New Member
     
    #3

    Aug 22, 2008, 05:13 PM
    / / Addition two numbers
    import javax.swing.*;// this package call in JOptionPane
    public class Addition
    { public static void main(String args[])
    {
    String fristNumber;
    String secondNumber;
    String result;

    int number1;
    int number2;
    // Ask the user to input two number

    firstNumber=JOptionPane.showInputDialog(''Enter first number'');
    secondNumber=JOptionpane.showInputDialog(''Enter second number'');

    // Methods below convert from string to int

    number1=Integer.parseInt(firsNumber);
    number2=Integer.parseInt(secondNumber);
    // formule that make addition of two numbers


    result=number1+number2;

    JOptionPane.showMessageDialog(null, '' the addition of two number is''+result); // Message dialog that will show the addition of two numbers

    }
    }




    I hope that this will help you !


    ****Naim****

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Java [ 3 Answers ]

Please will you help me with these questions... where can I find a great site that will help me answer these... 1/ Who developed Java and when? 2/ What are some unique features of Java? 3/ Is java used for websites or stand alone programs? 4/ What does it mean when I say java is an "object...

Java code [ 1 Answers ]

What is difference between argument and parameter element as use in calling routines/coding a method? Can one use them interchangeably for talking/writing purposes?

Java Is used for [ 2 Answers ]

When I rest my pointer over a link, it diplays information about that link Is that Java at work? Why are there different Jav versions? Is Java compiled like C or interpeted like Basic? Is this contained in Internet Explorer? Thank You very much

Java! [ 2 Answers ]

Please will you help me with these questions... where can I find a great site that will help me answer these... 1/ Who developed Java and when? 2/ What are some unique features of Java? 3/ Is java used for websites or stand alone programs? 4/ What does it mean when I say java is an "object...

Java Help! [ 1 Answers ]

Hi Experts, I'm not sure if I'm posting this in the right category, but I sure hope someone can still help me. I'm not able to view Java applets. I've downloaded the most recent version of JVM. I have version 1.4.1. I've tried changing some settings (like enabling Java in my internet...


View more questions Search