Learning Java
Start Date: 28-Mar-2020
End Date: 27-April-2020(expected)
KeyWords & Expressions
Keywords:
Java has 50 reserved words, which are used as keywords for applications. List of Java Keywords.
Expressions:
Expressions are actually building blocks of all Java program. Expressions are built with values, variables and operators.
Expressions are also built with Methods which we will see later.
package lectures;
public class KeyWordsAndExpressions {
public static void main(String[] args) {
// a mile is equal to 1.609344 kilometers
double kilometers = (100 * 1.60934);
int highScore = 50; //highScore = 50 is an expression
if (highScore == 50) {
System.out.println("This is an expression");
}
}
}
Explanation:
In the above code:
kilometers = (100 * 1.60934) is an expression
highScore = 50 is an expression
highScore == 50 is an expression
"This is an expression" is an expression
* remember that ';' , 'data type' ,
'keywords' (double, int, if in this code) are not
a part of the expression.