MainSum.java
public class MainSum {
public static void main(String[] args) {
int num1= 6;
int num2= 8;
int num3= 9;
int sum= num1+num2+num3;
System.out.println("The sum of three numbers are:"+sum);
}
}
/*->A variable is a container which holds the value while the Java program is executed
->Data types specify the different sizes and values that can be stored in the variable.
There are two types of data types in Java:
-> Primitive data types: The primitive data types include boolean, char, byte, short,
int, long, float and double.
-> Non-primitive data types: The non-primitive data types include Classes, Interfaces,
and Arrays
->int num1= 6;(Here num1 is variable name and int is data type ,6 is the value stored
in num1.)
->The structure of statements in a computer language is syntax.
*/
Comments
Post a Comment