Answers for "can you do add() with multiple variables in java"

1

adding 2 variable in java

public class sum{
	Public static void main(String args[]){
    	int x=5;
      	int y=10;
      	int sum= x+y;
      System.out.println("addition of x and y= "+sum);
    }
}
Posted by: Guest on November-08-2021
0

add two variables in java

public class Addition{
  	//simple addition method in Java
	public static void main(String args[]){
    	int x = 1; // initializing first variable with a value
      	int y = 3; // initializing second variable
      	
      	int sum = x + y; // new variable which is adding two variables x and y
      	
      	System.out.println( x + " + " + y + " = " + sum );
      	// printing the sum of variable on the console
    }
}
Posted by: Guest on October-04-2021

Code answers related to "can you do add() with multiple variables in java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language