Mastery
Java » Definitions

Statements and Blocks

Statement: Smallest independent unit in a program. It performs a piece of programming action.

// Each line is a statement.
int number1 = 10;
int number2, number3 = 99;
int product;
product = number1 * number2 * number3;
System.out.println("Hello");

Block: Group of statements surrounded by curly braces { }.

if (number == 88) {
   System.out.println("Got it!"); 
}
 

Class Basics

Member: A field or method within a class. Members can be public or private, and static or final. The public and private modifiers determine whether a member can be accessed outside of a class. From code that is outside of the class definition, we can’t access members that are private.