Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

how to sum two number using java

public class main{
  
  public static void main(String [] args){
    int num1 = 1;
    int num2 = 5;
    int result = num1 + num2;
   }
}
Comment

how to add two numbers in java

import java.util.*;
public class Add
{
  public static void main(String[] args)
  {
    Scanner sc=new Scanner(System.in);
    System.out.println("Enter 2 numbers");
    num1=sc.nextInt();
    num2=sc.nextInt();
    int sum=num1+num2;
    System.out.println("The sum of the two numbers is: "+sum);
  }
}
Comment

how to add 2 numbers in java

public class AddTwoNumbers {

   public static void main(String[] args) {
        
      int num1 = 5, num2 = 15, sum;
      sum = num1 + num2;

      System.out.println("Sum of these numbers: "+sum);
   }
}



Output:
Sum of these numbers: 20
Comment

how to plus two numbers in java

public class Rohit {
    public static void main (String[]args){

        int a=5;
        int b=6;
        int sum =a+b;

        System.out.println("The sum is: "+sum);
    }
    
}
Comment

how to plus two numbers in java

public class Rohit2 {
    public static void main (String[]args){

        int a=5;
        int b=6;
        int sum =a+b;

        System.out.println("The sum is: "+sum);
    }
    
}
Comment

how to plus two numbers in java

public class Rohit2 {
    public static void main (String[]args){

        int a=5;
        int b=6;
        int sum =a+b;

        System.out.println("The sum is: "+sum);
    }
    
}
Comment

PREVIOUS NEXT
Code Example
Java :: hello world in different programming languages 
Java :: how to generate random id in java 
Java :: java scanner string to int 
Java :: java singleton implementation 
Java :: for loop java 
Java :: open camera or gallery on button click android 
Java :: arrays.tostring java 
Java :: java distinct by key 
Java :: function in java 
Java :: java random between two strings 
Java :: java install in fedora 
Java :: print list array 
Java :: how to find a word in string in java 
Java :: java protected 
Java :: java date format with timezone 
Java :: java create new arraylist with elements 
Java :: java secretkey 
Java :: javafx change textfield background color 
Java :: ternary operator in java for null check 
Java :: how to find location of java jdk 
Java :: How to efficiently convert a sorted array into a min height binary search tree, in Java? 
Java :: fill two dimensional array row by row java 
Java :: java string static arrat 
Java :: scanner.hasnext() 
Java :: intent in java 
Java :: initialize applet in java 
Java :: java coalesce 
Java :: int [] to Integer[] 
Java :: how to find the prime numbers in java 
Java :: how to find selenium webelement java 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =