<s>
The	O
syntax	B-Application
of	O
Java	B-Language
is	O
the	B-Application
set	I-Application
of	I-Application
rules	I-Application
defining	O
how	O
a	O
Java	B-Language
program	O
is	O
written	O
and	O
interpreted	O
.	O
</s>
<s>
The	O
syntax	B-Application
is	O
mostly	O
derived	O
from	O
C	B-Language
and	O
C++	B-Language
.	O
</s>
<s>
Unlike	O
in	O
C++	B-Language
,	O
in	O
Java	B-Language
there	O
are	O
no	O
global	O
functions	O
or	O
variables	O
,	O
but	O
there	O
are	O
data	O
members	O
which	O
are	O
also	O
regarded	O
as	O
global	O
variables	O
.	O
</s>
<s>
The	O
Java	B-Language
syntax	I-Language
has	O
been	O
gradually	O
extended	O
in	O
the	O
course	O
of	O
numerous	O
major	O
JDK	B-Language
releases	O
,	O
and	O
now	O
supports	O
capabilities	O
such	O
as	O
generic	B-Language
programming	I-Language
and	O
function	B-General_Concept
literals	I-General_Concept
(	O
called	O
lambda	B-General_Concept
expressions	I-General_Concept
in	O
Java	B-Language
)	O
.	O
</s>
<s>
Since	O
2017	O
,	O
a	O
new	O
JDK	B-Language
version	O
is	O
released	O
twice	O
a	O
year	O
,	O
with	O
each	O
release	O
bringing	O
incremental	O
improvements	O
to	O
the	O
language	O
.	O
</s>
<s>
Identifiers	O
in	O
Java	B-Language
are	O
case-sensitive	O
.	O
</s>
<s>
Any	O
Unicode	O
character	O
that	O
is	O
a	O
letter	O
(	O
including	O
numeric	B-Algorithm
letters	O
like	O
Roman	O
numerals	O
)	O
or	O
digit	O
.	O
</s>
<s>
Since	O
Java	B-Language
SE	I-Language
7	O
,	O
it	O
is	O
possible	O
to	O
include	O
underscores	O
between	O
the	O
digits	O
of	O
a	O
number	O
to	O
increase	O
readability	O
;	O
for	O
example	O
,	O
a	O
number	O
can	O
be	O
written	O
as	O
.	O
</s>
<s>
Since	O
Java	B-Language
10	O
it	O
has	O
become	O
possible	O
to	O
infer	O
types	O
for	O
the	O
variables	O
automatically	O
by	O
using	O
var	O
.	O
</s>
<s>
Java	B-Language
has	O
three	O
kinds	O
of	O
comments	O
:	O
traditional	O
comments	O
,	O
end-of-line	O
comments	O
and	O
documentation	O
comments	O
.	O
</s>
<s>
This	O
type	O
of	O
comment	O
was	O
derived	O
from	O
C	B-Language
and	O
C++	B-Language
.	O
</s>
<s>
This	O
comment	O
type	O
is	O
also	O
present	O
in	O
C++	B-Language
and	O
in	O
modern	O
C	B-Language
.	O
</s>
<s>
Documentation	O
comments	O
in	O
the	O
source	O
files	O
are	O
processed	O
by	O
the	O
Javadoc	B-Language
tool	O
to	O
generate	O
documentation	O
.	O
</s>
<s>
This	O
type	O
of	O
comment	O
is	O
identical	O
to	O
traditional	O
comments	O
,	O
except	O
it	O
starts	O
with	O
/	O
**	O
and	O
follows	O
conventions	O
defined	O
by	O
the	O
Javadoc	B-Language
tool	O
.	O
</s>
<s>
Classes	O
in	O
the	O
package	O
java.lang	O
are	O
implicitly	O
imported	O
into	O
every	O
program	O
,	O
as	O
long	O
as	O
no	O
explicitly-imported	O
types	O
have	O
the	O
same	O
names	O
.	O
</s>
<s>
java.lang.Object	B-Language
Java	B-Language
's	O
top	O
type	O
.	O
</s>
<s>
java.lang.String	O
Java	B-Language
's	O
basic	O
string	O
type	O
.	O
</s>
<s>
Immutable	B-Application
.	O
</s>
<s>
java.lang.Throwable	B-General_Concept
supertype	O
of	O
everything	O
that	O
can	O
be	O
thrown	B-General_Concept
or	I-General_Concept
caught	I-General_Concept
with	O
Java	B-Language
's	O
throw	O
and	O
catch	O
statements	O
.	O
</s>
<s>
Java	B-Language
applications	O
consist	O
of	O
collections	O
of	O
classes	O
.	O
</s>
<s>
Every	O
Java	B-Language
application	O
must	O
have	O
an	O
entry	O
point	O
.	O
</s>
<s>
Unlike	O
C++	B-Language
or	O
C#	B-Application
,	O
it	O
never	O
returns	O
a	O
value	O
and	O
must	O
return	O
void	O
.	O
</s>
<s>
For	O
example	O
,	O
java.io.InputStream	O
is	O
a	O
fully	O
qualified	O
class	O
name	O
for	O
the	O
class	O
InputStream	O
which	O
is	O
located	O
in	O
the	O
package	O
java.io	O
.	O
</s>
<s>
The	O
above	O
class	O
myapplication.mylibrary.MyClass	O
will	O
have	O
the	O
following	O
path	O
:	O
myapplication/mylibrary/MyClass.java	O
.	O
</s>
<s>
A	O
"	O
static	B-Language
import	I-Language
"	O
imports	O
members	O
of	O
the	O
package	O
.	O
</s>
<s>
This	O
type	O
of	O
declaration	O
has	O
been	O
available	O
since	O
J2SE	B-Language
5.0	O
.	O
</s>
<s>
Static	B-Language
import	I-Language
declarations	O
allow	O
access	O
to	O
static	O
members	O
defined	O
in	O
another	O
class	O
,	O
interface	O
,	O
annotation	O
,	O
or	O
enum	B-Language
;	O
without	O
specifying	O
the	O
class	O
name	O
:	O
</s>
<s>
Enum	B-Language
constants	O
may	O
also	O
be	O
used	O
with	O
static	B-Language
import	I-Language
.	O
</s>
<s>
For	O
example	O
,	O
this	O
enum	B-Language
is	O
in	O
the	O
package	O
called	O
screen	O
:	O
</s>
<s>
It	O
is	O
possible	O
to	O
use	O
static	B-Language
import	I-Language
declarations	O
in	O
another	O
class	O
to	O
retrieve	O
the	O
enum	B-Language
constants	O
:	O
</s>
<s>
Operators	O
in	O
Java	B-Language
are	O
similar	O
to	O
those	O
in	O
C++	B-Language
.	O
</s>
<s>
However	O
,	O
there	O
is	O
no	O
delete	O
operator	O
due	O
to	O
garbage	B-General_Concept
collection	I-General_Concept
mechanisms	O
in	O
Java	B-Language
,	O
and	O
there	O
are	O
no	O
operations	O
on	O
pointers	O
since	O
Java	B-Language
does	O
not	O
support	O
them	O
.	O
</s>
<s>
Another	O
difference	O
is	O
that	O
Java	B-Language
has	O
an	O
unsigned	O
right	O
shift	O
operator	O
(>>>	O
)	O
,	O
while	O
C	B-Language
's	O
right	O
shift	O
operator	O
's	O
signedness	O
is	O
type-dependent	O
.	O
</s>
<s>
Operators	O
in	O
Java	B-Language
cannot	O
be	O
overloaded	O
.	O
</s>
<s>
~	O
Logical	O
NOT	O
and	O
bitwise	O
NOT	O
(	O
type	O
)	O
val	O
Type	O
cast	O
new	O
Class	O
instance	O
or	O
array	O
creation	O
4	O
*	O
/	O
%	O
Multiplication	O
,	O
division	O
,	O
and	O
modulus	O
(	O
remainder	O
)	O
Left-to-right	O
5	O
+	O
-	O
Addition	O
and	O
subtraction	O
+	O
String	O
concatenation	O
6	O
<< >> >>> Bitwise left shift, signed right shift and unsigned right shift 7 < <= Relational "less than" and "less than or equal to" > >	O
=	O
Relational	O
"	O
greater	O
than	O
"	O
and	O
"	O
greater	O
than	O
or	O
equal	O
to	O
"	O
instanceof	O
Type	O
comparison	O
8	O
==	O
!=	O
Relational	O
"	O
equal	O
to	O
"	O
and	O
"	O
not	O
equal	O
to	O
"	O
9	O
&	O
Bitwise	O
and	O
logical	O
AND	O
10	O
^	O
Bitwise	O
and	O
logical	O
XOR	O
(	O
exclusive	O
or	O
)	O
11	O
|	O
Bitwise	O
and	O
logical	O
OR	O
(	O
inclusive	O
or	O
)	O
12	O
&&	O
Logical	O
conditional-AND	O
13	O
||	O
Logical	O
conditional-OR	O
14	O
c	B-Language
?	O
</s>
<s>
t	O
:	O
f	O
Ternary	O
conditional	B-Language
(	O
see	O
?	O
</s>
<s>
if	B-Language
statements	I-Language
in	O
Java	B-Language
are	O
similar	O
to	O
those	O
in	O
C	B-Language
and	O
use	O
the	O
same	O
syntax	B-Application
:	O
</s>
<s>
if	O
statement	O
may	O
include	O
optional	O
else	O
block	O
,	O
in	O
which	O
case	O
it	O
becomes	O
an	O
if-then-else	B-Language
statement	O
:	O
</s>
<s>
Like	O
C	B-Language
,	O
else-if	O
construction	O
does	O
not	O
involve	O
any	O
special	O
keywords	O
,	O
it	O
is	O
formed	O
as	O
a	O
sequence	O
of	O
separate	O
if-then-else	B-Language
statements	O
:	O
</s>
<s>
Switch	O
statements	O
in	O
Java	B-Language
can	O
use	O
byte	O
,	O
short	O
,	O
char	O
,	O
and	O
int	O
(	O
note	O
:	O
not	O
long	O
)	O
primitive	O
data	O
types	O
or	O
their	O
corresponding	O
wrapper	O
types	O
.	O
</s>
<s>
Starting	O
with	O
J2SE	B-Language
5.0	O
,	O
it	O
is	O
possible	O
to	O
use	O
enum	B-Language
types	I-Language
.	O
</s>
<s>
Starting	O
with	O
Java	B-Language
SE	I-Language
7	O
,	O
it	O
is	O
possible	O
to	O
use	O
Strings	O
.	O
</s>
<s>
Other	O
reference	B-Language
types	I-Language
cannot	O
be	O
used	O
in	O
switch	O
statements	O
.	O
</s>
<s>
These	O
labels	O
in	O
Java	B-Language
may	O
contain	O
only	O
constants	O
(	O
including	O
enum	B-Language
constants	O
and	O
string	O
constants	O
)	O
.	O
</s>
<s>
Since	O
Java	B-Language
14	O
it	O
has	O
become	O
possible	O
to	O
use	O
switch	O
expressions	O
,	O
which	O
use	O
the	O
new	O
arrow	O
syntax	B-Application
:	O
</s>
<s>
Alternatively	O
,	O
there	O
is	O
a	O
possibility	O
to	O
express	O
the	O
same	O
with	O
the	O
yield	O
statement	O
,	O
although	O
it	O
is	O
recommended	O
to	O
prefer	O
the	O
arrow	O
syntax	B-Application
because	O
it	O
avoids	O
the	O
problem	O
of	O
accidental	O
fall	O
throughs	O
.	O
</s>
<s>
Since	O
J2SE	B-Language
5.0	O
,	O
Java	B-Language
has	O
four	O
forms	O
of	O
such	O
statements	O
.	O
</s>
<s>
for	O
loops	O
in	O
Java	B-Language
include	O
an	O
initializer	O
,	O
a	O
condition	O
and	O
a	O
counter	O
expression	O
.	O
</s>
<s>
However	O
,	O
unlike	O
C	B-Language
,	O
the	O
comma	O
is	O
just	O
a	O
delimiter	O
and	O
not	O
an	O
operator	O
.	O
</s>
<s>
Like	O
C	B-Language
,	O
all	O
three	O
expressions	O
are	O
optional	O
.	O
</s>
<s>
Enhanced	O
for	O
loops	O
have	O
been	O
available	O
since	O
J2SE	B-Language
5.0	O
.	O
</s>
<s>
Unlike	O
C#	B-Application
,	O
this	O
kind	O
of	O
loop	O
does	O
not	O
involve	O
a	O
special	O
keyword	O
,	O
but	O
instead	O
uses	O
a	O
different	O
notation	O
style	O
.	O
</s>
<s>
Note	O
that	O
the	O
Java	B-Language
goto	O
keyword	O
cannot	O
be	O
used	O
to	O
jump	O
to	O
specific	O
points	O
in	O
the	O
code	O
.	O
</s>
<s>
return	O
statement	O
ends	O
execution	O
immediately	O
,	O
except	O
for	O
one	O
case	O
:	O
if	O
the	O
statement	O
is	O
encountered	O
within	O
a	O
try	B-General_Concept
block	I-General_Concept
and	O
it	O
is	O
complemented	O
by	O
a	O
finally	O
,	O
control	O
is	O
passed	O
to	O
the	O
finally	O
block	O
.	O
</s>
<s>
The	O
statements	O
within	O
the	O
try	B-General_Concept
block	I-General_Concept
are	O
executed	O
,	O
and	O
if	O
any	O
of	O
them	O
throws	O
an	O
exception	O
,	O
execution	O
of	O
the	O
block	O
is	O
discontinued	O
and	O
the	O
exception	O
is	O
handled	O
by	O
the	O
catch	O
block	O
.	O
</s>
<s>
Java	B-Language
SE	I-Language
7	O
also	O
introduced	O
multi-catch	O
clauses	O
besides	O
uni-catch	O
clauses	O
.	O
</s>
<s>
This	O
type	O
of	O
catch	O
clauses	O
allows	O
Java	B-Language
to	O
handle	O
different	O
types	O
of	O
exceptions	O
in	O
a	O
single	O
block	O
provided	O
they	O
are	O
not	O
subclasses	O
of	O
each	O
other	O
.	O
</s>
<s>
The	O
exception	O
is	O
propagated	O
upwards	O
through	O
the	O
call	B-General_Concept
stack	I-General_Concept
until	O
a	O
matching	O
catch	O
block	O
is	O
found	O
within	O
one	O
of	O
the	O
currently	O
active	O
methods	O
.	O
</s>
<s>
The	O
catch	O
and	O
finally	O
blocks	O
are	O
optional	O
,	O
but	O
at	O
least	O
one	O
or	O
the	O
other	O
must	O
be	O
present	O
following	O
the	O
try	B-General_Concept
block	I-General_Concept
.	O
</s>
<s>
try-with-resources	O
statements	O
are	O
a	O
special	O
type	O
of	O
try-catch-finally	O
statements	O
introduced	O
as	O
an	O
implementation	O
of	O
the	O
dispose	B-Application
pattern	I-Application
in	O
Java	B-Language
SE	I-Language
7	O
.	O
</s>
<s>
In	O
a	O
try-with-resources	O
statement	O
the	O
try	O
keyword	O
is	O
followed	O
by	O
initialization	O
of	O
one	O
or	O
more	O
resources	O
that	O
are	O
released	O
automatically	O
when	O
the	O
try	B-General_Concept
block	I-General_Concept
execution	O
is	O
finished	O
.	O
</s>
<s>
Resources	O
must	O
implement	O
java.lang.AutoCloseable	O
.	O
</s>
<s>
Since	O
Java	B-Language
9	O
it	O
is	O
possible	O
to	O
use	O
already	O
declared	O
variables	O
:	O
</s>
<s>
Java	B-Language
has	O
built-in	O
tools	O
for	O
multi-thread	B-Operating_System
programming	I-Operating_System
.	O
</s>
<s>
For	O
the	O
purposes	O
of	O
thread	B-Operating_System
synchronization	O
the	O
synchronized	O
statement	O
is	O
included	O
in	O
Java	B-Language
language	I-Language
.	O
</s>
<s>
When	O
the	O
executing	O
thread	B-Operating_System
reaches	O
the	O
synchronized	O
block	O
,	O
it	O
acquires	O
a	O
mutual	B-Operating_System
exclusion	I-Operating_System
lock	O
,	O
executes	O
the	O
block	O
,	O
then	O
releases	O
the	O
lock	O
.	O
</s>
<s>
No	O
threads	B-Operating_System
may	O
enter	O
this	O
block	O
until	O
the	O
lock	O
is	O
released	O
.	O
</s>
<s>
Any	O
non-null	O
reference	B-Language
type	I-Language
may	O
be	O
used	O
as	O
the	O
lock	O
.	O
</s>
<s>
assert	O
statements	O
have	O
been	O
available	O
since	O
J2SE	B-Language
1.4	O
.	O
</s>
<s>
To	O
declare	O
an	O
assertion	O
the	O
assert	O
keyword	O
is	O
used	O
followed	O
by	O
a	O
conditional	B-Language
expression	O
.	O
</s>
<s>
Primitive	O
types	O
in	O
Java	B-Language
include	O
integer	O
types	O
,	O
floating-point	B-Algorithm
numbers	I-Algorithm
,	O
UTF-16	O
code	O
units	O
and	O
a	O
boolean	O
type	O
.	O
</s>
<s>
There	O
are	O
no	O
unsigned	O
types	O
in	O
Java	B-Language
except	O
char	O
type	O
,	O
which	O
is	O
used	O
to	O
represent	O
UTF-16	O
code	O
units	O
.	O
</s>
<s>
The	O
lack	O
of	O
unsigned	O
types	O
is	O
offset	O
by	O
introducing	O
unsigned	O
right	O
shift	O
operation	O
(>>>	O
)	O
,	O
which	O
is	O
not	O
present	O
in	O
C++	B-Language
.	O
</s>
<s>
Nevertheless	O
,	O
criticisms	O
have	O
been	O
leveled	O
about	O
the	O
lack	O
of	O
compatibility	O
with	O
C	B-Language
and	O
C++	B-Language
this	O
causes	O
.	O
</s>
<s>
This	O
language	O
feature	O
was	O
introduced	O
in	O
J2SE	B-Language
5.0	O
.	O
</s>
<s>
Boxing	O
is	O
the	O
operation	O
of	O
converting	O
a	O
value	O
of	O
a	O
primitive	O
type	O
into	O
a	O
value	O
of	O
a	O
corresponding	O
reference	B-Language
type	I-Language
,	O
which	O
serves	O
as	O
a	O
wrapper	O
for	O
this	O
particular	O
primitive	O
type	O
.	O
</s>
<s>
Unboxing	O
is	O
the	O
reverse	O
operation	O
of	O
converting	O
a	O
value	O
of	O
a	O
reference	B-Language
type	I-Language
(	O
previously	O
boxed	O
)	O
into	O
a	O
value	O
of	O
a	O
corresponding	O
primitive	O
type	O
.	O
</s>
<s>
Reference	B-Language
types	I-Language
include	O
class	O
types	O
,	O
interface	O
types	O
,	O
and	O
array	O
types	O
.	O
</s>
<s>
The	O
garbage	B-General_Concept
collector	I-General_Concept
then	O
collects	O
and	O
destroys	O
it	O
some	O
time	O
afterwards	O
.	O
</s>
<s>
Arrays	O
in	O
Java	B-Language
are	O
created	O
at	O
runtime	O
,	O
just	O
like	O
class	O
instances	O
.	O
</s>
<s>
In	O
Java	B-Language
,	O
multi-dimensional	O
arrays	O
are	O
represented	O
as	O
arrays	O
of	O
arrays	O
.	O
</s>
<s>
Due	O
to	O
the	O
nature	O
of	O
the	O
multi-dimensional	O
arrays	O
,	O
sub-arrays	O
can	O
vary	O
in	O
length	O
,	O
so	O
multi-dimensional	O
arrays	O
are	O
not	O
bound	O
to	O
be	O
rectangular	O
unlike	O
C	B-Language
:	O
</s>
<s>
Classes	O
are	O
fundamentals	O
of	O
an	O
object-oriented	O
language	O
such	O
as	O
Java	B-Language
.	O
</s>
<s>
Non-static	O
members	O
of	O
a	O
class	O
define	O
the	O
types	O
of	O
the	O
instance	B-Application
variables	I-Application
and	O
methods	O
,	O
which	O
are	O
related	O
to	O
the	O
objects	O
created	O
from	O
that	O
class	O
.	O
</s>
<s>
strictfp	O
-	O
Specifies	O
that	O
all	O
floating-point	B-Algorithm
operations	O
must	O
be	O
carried	O
out	O
conforming	O
to	O
IEEE	O
754	O
and	O
forbids	O
using	O
enhanced	O
precision	O
to	O
store	O
intermediate	O
results	O
.	O
</s>
<s>
The	O
access	O
modifiers	O
,	O
or	O
inheritance	B-Language
modifiers	O
,	O
set	O
the	O
accessibility	O
of	O
classes	O
,	O
methods	O
,	O
and	O
other	O
members	O
.	O
</s>
<s>
Since	O
Java	B-Language
has	O
a	O
garbage	B-General_Concept
collection	I-General_Concept
mechanism	O
,	O
there	O
are	O
no	O
destructors	B-Language
.	O
</s>
<s>
However	O
,	O
every	O
object	O
has	O
a	O
finalize( )	O
method	O
called	O
prior	O
to	O
garbage	B-General_Concept
collection	I-General_Concept
,	O
which	O
can	O
be	O
overridden	B-Language
to	O
implement	O
finalization	O
.	O
</s>
<s>
All	O
the	O
statements	O
in	O
Java	B-Language
must	O
reside	O
within	O
methods	O
.	O
</s>
<s>
Similar	O
to	O
C++	B-Language
,	O
methods	O
returning	O
nothing	O
have	O
return	O
type	O
declared	O
as	O
void	O
.	O
</s>
<s>
Unlike	O
in	O
C++	B-Language
,	O
methods	O
in	O
Java	B-Language
are	O
not	O
allowed	O
to	O
have	O
default	B-Language
argument	I-Language
values	O
and	O
methods	O
are	O
usually	O
overloaded	O
instead	O
.	O
</s>
<s>
abstract	O
-	O
Abstract	O
methods	O
can	O
be	O
present	O
only	O
in	O
abstract	O
classes	O
,	O
such	O
methods	O
have	O
no	O
body	O
and	O
must	O
be	O
overridden	B-Language
in	O
a	O
subclass	O
unless	O
it	O
is	O
abstract	O
itself	O
.	O
</s>
<s>
final	O
-	O
Declares	O
that	O
the	O
method	O
cannot	O
be	O
overridden	B-Language
in	O
a	O
subclass	O
.	O
</s>
<s>
native	O
-	O
Indicates	O
that	O
this	O
method	O
is	O
implemented	O
through	O
JNI	B-Language
in	O
platform-dependent	O
code	O
.	O
</s>
<s>
Actual	O
implementation	O
happens	O
outside	O
Java	B-Language
code	I-Language
,	O
and	O
such	O
methods	O
have	O
no	O
body	O
.	O
</s>
<s>
strictfp	O
-	O
Declares	O
strict	O
conformance	O
to	O
IEEE	O
754	O
in	O
carrying	O
out	O
floating-point	B-Algorithm
operations	O
.	O
</s>
<s>
synchronized	O
-	O
Declares	O
that	O
a	O
thread	B-Operating_System
executing	O
this	O
method	O
must	O
acquire	O
monitor	O
.	O
</s>
<s>
For	O
synchronized	O
methods	O
the	O
monitor	O
is	O
the	O
class	O
instance	O
or	O
java.lang.Class	O
if	O
the	O
method	O
is	O
static	O
.	O
</s>
<s>
This	O
language	O
feature	O
was	O
introduced	O
in	O
J2SE	B-Language
5.0	O
.	O
</s>
<s>
The	O
last	O
argument	O
of	O
the	O
method	O
may	O
be	O
declared	O
as	O
a	O
variable	O
arity	O
parameter	O
,	O
in	O
which	O
case	O
the	O
method	O
becomes	O
a	O
variable	O
arity	O
method	O
(	O
as	O
opposed	O
to	O
fixed	O
arity	O
methods	O
)	O
or	O
simply	O
varargs	B-Language
method	O
.	O
</s>
<s>
Fields	O
,	O
or	O
class	B-Application
variables	I-Application
,	O
can	O
be	O
declared	O
inside	O
the	O
class	O
body	O
to	O
store	O
data	O
.	O
</s>
<s>
transient	O
-	O
Indicates	O
that	O
this	O
field	O
will	O
not	O
be	O
stored	O
during	O
serialization	B-Application
.	O
</s>
<s>
volatile	O
-	O
If	O
a	O
field	O
is	O
declared	O
volatile	O
,	O
it	O
is	O
ensured	O
that	O
all	O
threads	B-Operating_System
see	O
a	O
consistent	O
value	O
for	O
the	O
variable	O
.	O
</s>
<s>
Classes	O
in	O
Java	B-Language
can	O
only	O
inherit	B-Language
from	O
one	O
class	O
.	O
</s>
<s>
Inheritance	B-Language
is	O
declared	O
using	O
the	O
extends	O
keyword	O
.	O
</s>
<s>
If	O
a	O
class	O
does	O
not	O
specify	O
its	O
superclass	O
,	O
it	O
implicitly	O
inherits	O
from	O
java.lang.Object	B-Language
class	O
.	O
</s>
<s>
Thus	O
all	O
classes	O
in	O
Java	B-Language
are	O
subclasses	O
of	O
Object	O
class	O
.	O
</s>
<s>
Unlike	O
C++	B-Language
,	O
all	O
non-final	O
methods	O
in	O
Java	B-Language
are	O
virtual	B-Application
and	O
can	O
be	O
overridden	B-Language
by	O
the	O
inheriting	O
classes	O
.	O
</s>
<s>
A	O
class	O
C	B-Language
has	O
abstract	O
methods	O
if	O
any	O
of	O
the	O
following	O
is	O
true	O
:	O
</s>
<s>
C	B-Language
explicitly	O
contains	O
a	O
declaration	O
of	O
an	O
abstract	O
method	O
.	O
</s>
<s>
Any	O
of	O
C	B-Language
's	O
superclasses	O
has	O
an	O
abstract	O
method	O
and	O
C	B-Language
neither	O
declares	O
nor	O
inherits	O
a	O
method	O
that	O
implements	B-Language
it	O
.	O
</s>
<s>
A	O
direct	O
superinterface	O
of	O
C	B-Language
declares	O
or	O
inherits	O
a	O
method	O
(	O
which	O
is	O
therefore	O
necessarily	O
abstract	O
)	O
and	O
C	B-Language
neither	O
declares	O
nor	O
inherits	O
a	O
method	O
that	O
implements	B-Language
it	O
.	O
</s>
<s>
A	O
subclass	O
of	O
an	O
abstract	O
class	O
that	O
is	O
not	O
itself	O
abstract	O
may	O
be	O
instantiated	O
,	O
resulting	O
in	O
the	O
execution	O
of	O
a	O
constructor	O
for	O
the	O
abstract	O
class	O
and	O
,	O
therefore	O
,	O
the	O
execution	O
of	O
the	O
field	O
initializers	O
for	O
instance	B-Application
variables	I-Application
of	O
that	O
class	O
.	O
</s>
<s>
This	O
language	O
feature	O
was	O
introduced	O
in	O
J2SE	B-Language
5.0	O
.	O
</s>
<s>
Technically	O
enumerations	B-Language
are	O
a	O
kind	O
of	O
class	O
containing	O
enum	B-Language
constants	O
in	O
its	O
body	O
.	O
</s>
<s>
Each	O
enum	B-Language
constant	O
defines	O
an	O
instance	O
of	O
the	O
enum	B-Language
type	O
.	O
</s>
<s>
Enumeration	B-Language
classes	O
cannot	O
be	O
instantiated	O
anywhere	O
except	O
in	O
the	O
enumeration	B-Language
class	O
itself	O
.	O
</s>
<s>
Enum	B-Language
constants	O
are	O
allowed	O
to	O
have	O
constructors	O
,	O
which	O
are	O
called	O
when	O
the	O
class	O
is	O
loaded	O
:	O
</s>
<s>
Enumerations	B-Language
can	O
have	O
class	O
bodies	O
,	O
in	O
which	O
case	O
they	O
are	O
treated	O
like	O
anonymous	O
classes	O
extending	O
the	O
enum	B-Language
class	O
:	O
</s>
<s>
Interfaces	B-Language
are	O
types	O
which	O
contain	O
no	O
fields	O
and	O
usually	O
define	O
a	O
number	O
of	O
methods	O
without	O
an	O
actual	O
implementation	O
.	O
</s>
<s>
Interface	O
methods	O
are	O
allowed	O
to	O
have	O
a	O
subset	O
of	O
access	O
modifiers	O
depending	O
on	O
the	O
language	O
version	O
,	O
strictfp	O
,	O
which	O
has	O
the	O
same	O
effect	O
as	O
for	O
classes	O
,	O
and	O
also	O
static	O
since	O
Java	B-Language
SE	I-Language
8	O
.	O
</s>
<s>
An	O
interface	O
is	O
implemented	O
by	O
a	O
class	O
using	O
the	O
implements	B-Language
keyword	O
.	O
</s>
<s>
It	O
is	O
allowed	O
to	O
implement	O
more	O
than	O
one	O
interface	O
,	O
in	O
which	O
case	O
they	O
are	O
written	O
after	O
implements	B-Language
keyword	O
in	O
a	O
comma-separated	O
list	O
.	O
</s>
<s>
Class	O
implementing	O
an	O
interface	O
must	O
override	B-Language
all	O
its	O
methods	O
,	O
otherwise	O
it	O
must	O
be	O
declared	O
as	O
abstract	O
.	O
</s>
<s>
These	O
features	O
were	O
introduced	O
with	O
the	O
release	O
of	O
Java	B-Language
SE	I-Language
8	O
.	O
</s>
<s>
In	O
this	O
case	O
an	O
implementation	O
can	O
be	O
represented	O
as	O
a	O
lambda	B-General_Concept
expression	I-General_Concept
instead	O
of	O
implementing	O
it	O
in	O
a	O
new	O
class	O
,	O
thus	O
greatly	O
simplifying	O
writing	O
code	O
in	O
the	O
functional	B-Language
style	I-Language
.	O
</s>
<s>
Functional	O
interfaces	B-Language
can	O
optionally	O
be	O
annotated	O
with	O
the	O
@FunctionalInterface	O
annotation	O
,	O
which	O
will	O
tell	O
the	O
compiler	O
to	O
check	O
whether	O
the	O
interface	O
actually	O
conforms	O
to	O
a	O
definition	O
of	O
a	O
functional	O
interface	O
.	O
</s>
<s>
Lambda	B-General_Concept
's	O
parameters	O
types	O
do	O
n't	O
have	O
to	O
be	O
fully	O
specified	O
and	O
can	O
be	O
inferred	O
from	O
the	O
interface	O
it	O
implements	B-Language
.	O
</s>
<s>
Lambda	B-General_Concept
's	O
body	O
can	O
be	O
written	O
without	O
a	O
body	O
block	O
and	O
a	O
return	O
statement	O
if	O
it	O
is	O
only	O
an	O
expression	O
.	O
</s>
<s>
Also	O
,	O
for	O
those	O
interfaces	B-Language
which	O
only	O
have	O
a	O
single	O
parameter	O
in	O
the	O
method	O
,	O
round	O
brackets	O
can	O
be	O
omitted	O
.	O
</s>
<s>
It	O
is	O
not	O
necessary	O
to	O
use	O
lambdas	B-General_Concept
when	O
there	O
already	O
is	O
a	O
named	O
method	O
compatible	O
with	O
the	O
interface	O
.	O
</s>
<s>
This	O
method	O
can	O
be	O
passed	O
instead	O
of	O
a	O
lambda	B-General_Concept
using	O
a	O
method	O
reference	O
.	O
</s>
<s>
Interfaces	B-Language
can	O
inherit	B-Language
from	O
other	O
interfaces	B-Language
just	O
like	O
classes	O
.	O
</s>
<s>
Unlike	O
classes	O
it	O
is	O
allowed	O
to	O
inherit	B-Language
from	O
multiple	O
interfaces	B-Language
.	O
</s>
<s>
However	O
,	O
it	O
is	O
possible	O
that	O
several	O
interfaces	B-Language
have	O
a	O
field	O
with	O
the	O
same	O
name	O
,	O
in	O
which	O
case	O
it	O
becomes	O
a	O
single	O
ambiguous	O
member	O
,	O
which	O
cannot	O
be	O
accessed	O
.	O
</s>
<s>
Java	B-Language
SE	I-Language
8	O
introduced	O
default	O
methods	O
to	O
interfaces	B-Language
which	O
allows	O
developers	O
to	O
add	O
new	O
methods	O
to	O
existing	O
interfaces	B-Language
without	O
breaking	O
compatibility	O
with	O
the	O
classes	O
already	O
implementing	O
the	O
interface	O
.	O
</s>
<s>
Unlike	O
regular	O
interface	O
methods	O
,	O
default	O
methods	O
have	O
a	O
body	O
which	O
will	O
get	O
called	O
in	O
the	O
case	O
if	O
the	O
implementing	O
class	O
does	O
n't	O
override	B-Language
it	O
.	O
</s>
<s>
Static	O
methods	O
is	O
another	O
language	O
feature	O
introduced	O
in	O
Java	B-Language
SE	I-Language
8	O
.	O
</s>
<s>
Private	O
methods	O
were	O
added	O
in	O
the	O
Java	B-Language
9	O
release	O
.	O
</s>
<s>
Annotations	O
in	O
Java	B-Language
are	O
a	O
way	O
to	O
embed	O
metadata	O
into	O
code	O
.	O
</s>
<s>
This	O
language	O
feature	O
was	O
introduced	O
in	O
J2SE	B-Language
5.0	O
.	O
</s>
<s>
Java	B-Language
has	O
a	O
set	O
of	O
predefined	O
annotation	O
types	O
,	O
but	O
it	O
is	O
allowed	O
to	O
define	O
new	O
ones	O
.	O
</s>
<s>
They	O
are	O
declared	O
in	O
the	O
same	O
way	O
as	O
the	O
interfaces	B-Language
,	O
except	O
the	O
interface	O
keyword	O
is	O
preceded	O
by	O
the	O
@	O
sign	O
.	O
</s>
<s>
All	O
annotations	O
are	O
implicitly	O
extended	O
from	O
java.lang.annotation.Annotation	O
and	O
cannot	O
be	O
extended	O
from	O
anything	O
else	O
.	O
</s>
<s>
Annotations	O
may	O
have	O
the	O
same	O
declarations	O
in	O
the	O
body	O
as	O
the	O
common	O
interfaces	B-Language
,	O
in	O
addition	O
they	O
are	O
allowed	O
to	O
include	O
enums	B-Language
and	O
annotations	O
.	O
</s>
<s>
Annotations	O
may	O
be	O
used	O
in	O
any	O
kind	O
of	O
declaration	O
,	O
whether	O
it	O
is	O
package	O
,	O
class	O
(	O
including	O
enums	B-Language
)	O
,	O
interface	O
(	O
including	O
annotations	O
)	O
,	O
field	O
,	O
method	O
,	O
parameter	O
,	O
constructor	O
,	O
or	O
local	O
variable	O
.	O
</s>
<s>
Also	O
they	O
can	O
be	O
used	O
with	O
enum	B-Language
constants	O
.	O
</s>
<s>
Generics	B-Language
,	O
or	O
parameterized	B-Language
types	I-Language
,	O
or	O
parametric	O
polymorphism	O
is	O
one	O
of	O
the	O
major	O
features	O
introduced	O
in	O
J2SE	B-Language
5.0	O
.	O
</s>
<s>
Before	O
generics	B-Language
were	O
introduced	O
,	O
it	O
was	O
required	O
to	O
declare	O
all	O
the	O
types	O
explicitly	O
.	O
</s>
<s>
With	O
generics	B-Language
it	O
became	O
possible	O
to	O
work	O
in	O
a	O
similar	O
manner	O
with	O
different	O
types	O
without	O
declaring	O
the	O
exact	O
types	O
.	O
</s>
<s>
The	O
main	O
purpose	O
of	O
generics	B-Language
is	O
to	O
ensure	O
type	O
safety	O
and	O
to	O
detect	O
runtime	O
errors	O
during	O
compilation	O
.	O
</s>
<s>
Unlike	O
C#	B-Application
,	O
information	O
on	O
the	O
used	O
parameters	O
is	O
not	O
available	O
at	O
runtime	O
due	O
to	O
type	B-General_Concept
erasure	I-General_Concept
.	O
</s>
<s>
If	O
the	O
variable	O
is	O
constrained	O
by	O
both	O
class	O
and	O
interface	O
or	O
if	O
there	O
are	O
several	O
interfaces	B-Language
,	O
the	O
class	O
name	O
is	O
written	O
first	O
,	O
followed	O
by	O
interface	O
names	O
with	O
&	O
sign	O
used	O
as	O
the	O
delimiter	O
.	O
</s>
<s>
When	O
a	O
variable	O
of	O
a	O
parameterized	B-Language
type	I-Language
is	O
declared	O
or	O
an	O
instance	O
is	O
created	O
,	O
its	O
type	O
is	O
written	O
exactly	O
in	O
the	O
same	O
format	O
as	O
in	O
the	O
class	O
header	O
,	O
except	O
the	O
actual	O
type	O
is	O
written	O
in	O
the	O
place	O
of	O
the	O
type	O
variable	O
declaration	O
.	O
</s>
<s>
Since	O
Java	B-Language
SE	I-Language
7	O
,	O
it	O
is	O
possible	O
to	O
use	O
a	O
diamond	O
(	O
<>	O
)	O
in	O
place	O
of	O
type	O
arguments	O
,	O
in	O
which	O
case	O
the	O
latter	O
will	O
be	O
inferred	O
.	O
</s>
<s>
The	O
following	O
code	O
in	O
Java	B-Language
SE	I-Language
7	O
is	O
equivalent	O
to	O
the	O
code	O
in	O
the	O
previous	O
example	O
:	O
</s>
<s>
When	O
declaring	O
a	O
variable	O
for	O
a	O
parameterized	B-Language
type	I-Language
,	O
it	O
is	O
possible	O
to	O
use	O
wildcards	O
instead	O
of	O
explicit	O
type	O
names	O
.	O
</s>
<s>
Usage	O
of	O
generics	B-Language
may	O
be	O
limited	O
to	O
some	O
particular	O
methods	O
,	O
this	O
concept	O
applies	O
to	O
constructors	O
as	O
well	O
.	O
</s>
<s>
Interfaces	B-Language
can	O
be	O
parameterized	O
in	O
the	O
similar	O
manner	O
as	O
the	O
classes	O
.	O
</s>
