Java Language
Internal
Lexical Structure
Keywords
- synchronized. See synchronized statement and synchronized modifier.
- static. See class variables.
Statements
synchronized
The synchronized statement acquires a mutual-exclusion lock on behalf of the executing thread, executes a block, then releases the lock. While the executing thread owns the log, no other thread may acquire the lock.
synchronized (expression) block
The type of expression must be a reference type.
Also see:
Modifiers
Method Modifiers
synchronized
A synchronized class method synchronizes on the monitor associated with the Class object of that class.
A synchronized instance method synchronizes on the monitor associated with this - the object instance it is invoked onto.
Also see:
default
Literals
Operators
Types
Java is a statically typed language, which means that every variable and every expression has a type that is known at compile time.
Java is strongly typed language, because the types limit the values a variable can hold or that an expression can produce, limit the operations supported by those types and determine the meaning of operations.
Primitive Types
Reference Types
There are four kinds of reference types: class types, interface types, type variables and array types.
Class Types
Interface Types
Type Variables
Array Types
Values
Variables
A variable is a storage location and has an associated type - the compile-time type - that is either a primitive type or a reference type.
The value of a variable is changed by an assignment or by a prefix/postfix increment/decrement operators.
There are eight kinds of variables:
Class Variable
A class variable is a field declared using the keyword static within a class declaration, or with or without the keyword static within an interface declaration.
Instance Variable
An instance variable is a field declared within a class declaration without using the keyword static.
Array Component
Array components are unnamed variables that are created and initialized to default values whenever a new object that is an array is created.
Method Parameter
Method parameters
Constructor Parameter
Lambda Parameter
Exception Parameter
Local Variable
Expressions
Interface
An interface groups related methods together into a contract.
Class
Anonymous Class
Can be used for behavior parameterization.