Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

class AddTwoNumbers

//Class Declaration

public static void main(String args[]) //Main Function


{
int x, y, z;
// Variable Declaration
x = 10;
//Assigning 10 to the variable x.
y = 20;
//Assigning 20 to the variable y.
z = x + y;
//Expression to Add two variables x, y and save the result to z
System.out.println("Sum of x and y = "+z); //This line output the value of z on the Screen
}
}

You might also like