You are on page 1of 1

JAVA SYNTAX CHEAT SHEET

Control BASIC DEFINITIONS PRIMITIVE DATA TYPES Key


Flow Class Describes a particular kind of object. It can Type Description Bits Words
contain related methods and variables. abstract
Selection (Integers)
If Method A function defined in a class. Methods assert
byte Byte-length integer 8
Else implement the behavior for objects. boolean
Switch short Short integer 16 break
Object The principal building blocks of Java.
Case int Integer 32 byte
Objects consist of variables (data) and
case
Loop methods (functionality). long Long integer 64 catch
While
(Real Numbers) char
Do
For
COMMENTS float Single-precision floating point 32 class
const
Exception HTML Comments double Double-precision floating point 64 continue
Throw <!-- comment --> Sent to the client in the viewable (Other) default
Try page source. do
Catch char A single character 16
JSP Commens (Not Sent to Client) double
Finally boolean A boolean value (true or false) 1 else
Branch <%-- comment Comments in JSP file.
enum
--%>
Return OPERATORS extends
Break // comment Comment in scriplet part of JSP false
Continue file. + addition of numbers, concatenation of final
Label Strings finally
+= add and assign numbers, concatenate float
ELEMENTS
and assign Strings for
Declaration goto
- subtraction
<%! declaration %> Creates a global if
variable or method. -= subtract and assign implements
* multiplication import
Expression instanceof
<%= expression %> Statements evaluated *= multiply and assign int
on the server before / division interface
the page is outputted to /= divide and assign long
the client. native
% take remainder new
Page Directive
%= take remainder and assign null
<%@ directive %> Attributes that apply to package
the entire page. ++ increment by one
private
Scriplet -- decrement by one protected
> greater than public
<% code fragment of one or Contains a block of
return
more lines %> scripting code which is >= greater than or equal to
executed when the short
< less than static
page is generated.
<= less than or equal to strictfp
Taglib Directive super
<%@ taglib Defines a tag library ! boolean NOT switch
uri="URIToTagLibrary" and prefix for tags used != not equal to synchronized
prefix="tagPrefix" %> in a JSP page. this
&& boolean AND
throw
|| boolean OR throws
SEPARATORS transient
== boolean equals
( ) Used to surround parameters true
= assignment try
{ } Defines a block of code for a class or method or
void
to contain the values of automatically initialized
volatile
arrays
while
[ ] Declares arrays or references array values
; Denotes the end of a statement
, Separates variables
. Separates package names from subpackages/
classes or a variable/method from a reference
variable

You might also like