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

lxgeek :

I'm a beginner for Java, and I want to know the difference between expressions and statements in Java?

fastcodejava :

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 (not SQL).

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=446404&siteId=1
Recommended