Expression Statements
class ABC {
public void display() {
System.out.println("Hello World...!!!");
}
}
public class ExpressionStatements {
public static void main(String[] args) {
int a = 5,b=10; //declaration statement
System.out.println("Value of a : " + a); //assignment statement
a++; //increment statement
b--; //decrement statement
System.out.println("Incremented value of a : " + a); //method invocation statement;here println() is a method
System.out.println("Decremented value of b : " + b);
ABC abc = new ABC(); //object creation expressions;here creates object of class ABC
abc.display();
}
}
Output:
Value of a : 5
Incremented value of a : 6
Decremented value of b : 9
Hello World...!!!