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 :: Removing DOM nodes when traversing a NodeList 
Java :: how to know when user is done typing android 
Java :: java ultimo dia del mes 
Java :: make handler running continuously 
Java :: heap vs string constant pool 
Java :: java tostring methode überschreiben 
Java :: tomcat allow remote access to manager 
Java :: hierarchy inheritance gfg java 
Java :: how to convert string to space separated int in java 
Java :: set bean properties 
Java :: java csvformat example semi colon 
Java :: android loop through string array 
Java :: what is serialization in rest assured 
Java :: java radom float 
Java :: java cors issue 
Java :: java @documented 
Java :: how to check if a value is integer or not in java 
Java :: Create all possible substrings of a string java 
Java :: java declare and populate array 
Java :: Java remove element in a array - set to null 
Java :: java replace ignore case 
Java :: how to sort a collection using stream 
Java :: textbox to arraylist 
Java :: change the default port in spring boot codegrepper 
Java :: Log exception details to string 
Java :: also in java 
Java :: witch dependency is needed for "ArraysUtils" for the Import? 
Java :: how to disable the auto-configuration? 
Java :: java 8 validate based on pair of strings 
Java :: minecraft java plugin shift 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =