javaexpressionstatements

What is the difference between an expression and a statement in Java?


What is the difference between an expression and a statement in Java?


Solution

  • This is an example:

    b + 1 is an expression while a = b + 1; is a statement. A statement consists of expressions.

    This is not specific to the Java language. Many languages use this kind of grammar e.g. C, C++, Basic, etc. (but not SQL).