1. abstract
Class:
When used in a named class declaration, abstract specifies the class cannot be instantiated and should be extended by other classes.
A final class cannot be abstract.
Anonymous classes cannot be abstract. The extends clause requires a named class.
Method:
Abstract can be used in a method declaration to declare an empty method without implementation.
An abstract class can have abstract methods that are not implemented in the abstract class. However, a class can be declared abstract without containing any abstract methods.
A class is abstract if it inherits abstract methods and doesn't implement them.
Interface:
An interface declares a set of abstract methods. The methods declared in an interface are implicitly abstract.
2. assert
An assert statement evaluates a boolean expression you believe to be true. It does nothing if the expression is true but terminates the program if it is false.
In Android, import the Assert class:
import static junit.framework.Assert.*;
Use Assert methods such as: assertTrue(); assertEquals(); assertNull();
3. boolean
The primitive boolean type has two values represented by the boolean literals: true and false. The default value of a boolean variable is false.
The Boolean wrapper class can be null. The default value of a Boolean variable is null.
4. break
A break statement with no label:
A break statement transfers control out of an enclosing statement. A break statement with no label attempts to transfer control to the innermost enclosing switch, while, do, or for statement.
A break statement with a label:
A break statement with a label attempts to transfer control to the enclosing labeled statement that is prefixed with the same identifier as the break label. This statement is referred to as the break target.
If you use a break statement with a label the break target does not have to be a switch, while, do, or for statement.
5. byte
The byte is a primitive type that is a numeric 8-bit signed two's-complement integer. It has a minimum value of -27 (-128) and a maximum value of 27-1 (127).
The default value is zero, that is, the value of (byte)0.
6. case
In a switch statement, each case label has a case constant that is either a constant expression, the name of an enum constant, or in Java SE7 or higher a string. Any statement in the switch block can have multiple case labels and constants.
Each case constant associated with the switch statement must be assignment compatible with the type of the switch statement's expression.
7. catch
If an exception is thrown in a preceding try block, the catch keyword defines a group of statements that can be executed to handle the exception.
The code in the catch block is executed if the class of the thrown exception is assignment compatible with the exception class parameter specified in the catch clause.
8. char
The primitive type char is a 16-bit Unicode character. Char is a numeric type and its default value is the null character, that is, '\u0000'.
9. class
Named class:
A class declaration defines a new reference type and describes how it is implemented.
Anonymous class:
An anonymous class declaration defines a new reference type and describes how it is implemented. Anonymous classes cannot be abstract.
10. const
The const keyword is not used in current versions of the Java programming language. The const keyword is used in other programming languages and the Java compiler can produce better error messages if the keyword incorrectly appears in a Java program.
11. continue
A continue statement skips one loop iteration and can occur only in a while, do, or for statement.
A continue statement with no label transfers control to the innermost enclosing while, do, or for statement.
A continue statement with a label skips the current iteration of the outermost loop marked with the specified label.
12. default
In a switch statement, the default keyword defines a group of statements that run if the switch statement's expression does not match a value specified by any of the case constants. At most one default label is associated with the switch statement.
An interface may contain default methods that supply implementations. They are defined using the default modifier in the method's header.
13. do
Used to declare a do-while loop that iterates a block of statements while an expression is true.
The loop's exit condition is specified using the while keyword with an associated boolean expression.
The loop executes once before evaluating the exit condition.
14. double
The primitive type double is a numeric 64-bit floating point type. A floating-point literal is of type double by default though it can optionally be suffixed with a D or d. The default value is 0.0d.
15. else
Used to define an optional block of statements that are executed when the boolean test expression specified by the if keyword is false, and when the boolean test expressions specified by any optional else if blocks are also false.
16. enum
The enum keyword is used to declare an enumerated type. An enum defines a fixed set of constants.
Enumerations extend the base class Enum.
17. extends
The extends keyword is used in a class declaration to specify the class's superclass, and in an interface declaration to specify one or more superinterfaces.
18. final
Class:
A final class cannot be subclassed
Method:
A final method cannot be overridden.
Field:
The value of a final variable cannot change. If a final variable holds a reference to an object, the state of the object can be changed by operations on the object, but the variable will always refer to the same object.
All methods in a final class are implicitly final.
19. finally
When exception handling, a finally block always executes when a try block exits whether an exception was thrown or not.
finally can also be useful to avoid having cleanup code bypassed by a return, continue, or break statement.
20. float
A float is a primitive 32-bit floating point numeric type. A floating-point literal is of type float if it is suffixed with an F or f, otherwise its type is double and it can optionally be suffixed with a D or d. The default value is 0.0f.
21. for
Used to define a loop that iterates statements.
A for loop initializes one or more loop variables, defines a boolean exit condition, defines one or more increment expressions, and specifies the statements to be executed in the loop.
The exit condition is evaluated before the first iteration of the loop.
A form of the for loop called an enhanced for loop or a for each loop specifies an element and an iterable object or array where each iteration of the loop processes one element.
22. goto
This keyword is not used by current versions of the Java programming language. Enables a compiler to produce better error messages if this keyword, used in other programming languages, incorrectly appears in a Java program.
23. if
Used to conditionally execute a block of statements when the boolean expression associated with the if keyword is true.
An optional block can be specified using the else keyword that executes the statement block when the if expression evaluates to false.
24. implements
Included in a class declaration to indicate that it implements one or more interfaces.
25. import
Used at the beginning of a source file to specify classes, or entire Java packages, that can be referred to without including their package names in the reference.
A single-type-import declaration:
Imports a single type by giving its canonical name, making it available under a simple name in the class and interface declarations of the compilation unit in which the single-type-import declaration appears.
A type-import-on-demand declaration:
Allows all accessible types of a named package or type to be imported as needed. The PackageOrTypeName must be the canonical name of a package, a class type, an interface type, an enum type, or an annotation type.
A single-static-import declaration:
Imports all accessible static members with a given simple name from a type. This makes these static members available under their simple name in the class and interface declarations of the compilation unit in which the single-static-import declaration appears. The TypeName must be the canonical name of a class type, interface type, enum type, or annotation type.
A static-import-on-demand declaration allows all accessible static members of a named type to be imported as needed. The TypeName must be the canonical name of a class type, interface type, enum type, or annotation type.
26. instanceof
A binary operator that takes an object reference as its first operand and a class or interface as its second operand and produces a boolean result.
The instanceof operator evaluates to true only if the runtime type of the object is assignment compatible with the class or interface.
27. int
int is a numeric 32-bit signed two's-complement integer primitive type. It has a minimum value of -231 and a maximum value of 231-1 with a default value of 0.
28. interface
An interface defines a reference type that cannot be directly instantiated and has members that can be classes, interfaces, constants, and abstract methods. An interface cannot declare instance variables.
Java 8SE added support for default and static methods with implementations.
Classes that can be unrelated may implement one, or multiple, interfaces by providing implementations for the Interface's abstract methods.
A top level interface is an interface that is not a nested interface.
A nested interface is any interface whose declaration occurs within the body of another class or interface.
29. long
long is a numeric 64-bit signed two's-complement integer primitive type. It has a minimum value of -263 and a maximum value of 263-1 with a default value of 0L or 0l.
30. native
A native method is implemented in platform-dependent code, typically in another programming language such as C. The body of a native method is written as a semicolon indicating the implementation is omitted.
31. new
The new keyword is used to create an instance of a class or array.
32. package
A package defines a group of types (classes and interfaces).
Packages are declared with the package keyword.
Packages provide these benefits:
They create a namespace to help avoid type naming conflicts.
They create a logical group of types.
They provide package access protection.
33. private
A private class, member, or constructor is accessible only within the body of the top level class that encloses the declaration of the member or constructor. Private code elements are not inherited by subclasses.
34. protected
The protected keyword is an access modifier that can be used in a method, field, or inner class declaration.
protected signifies the member can only be accessed by code in its package, class, subclasses, or subclasses in another package if the following conditions are met:
The accessing code in the other package must use parameter object references that are a subclass of the superclass that declared the protected members.
The accessing code also needs visibility (Public superclass + Import or FQN) to the superclass in the other package.
Also see: Java 8SE Specification
6.6.2 Details on protected Access
35. public
Public is an access modifier that can be used in a class, method, or field declaration.
It signifies the class, method, or field can be accessed by code in other classes or packages.
All members declared in an interface are implicitly public.
36. return
A return statement in a method or constructor transfers control to the code that invoked the method or constructor.
A return statement has two forms: one that returns a value, and one that doesn't. To return a value, put the value or expression that calculates the value after the return statement.
A void method cannot contain a return statement.
37. short
short is a numeric 16-bit signed two's-complement integer primitive type. It has a minimum value of -215 (-32,768) and a maximum value of 215-1 (32,767). The default value is zero, that is, the value of (short)0.
38. static
The static keyword can be used to declare that a field, method, or inner class is associated with a class instead of with an instance.
Class methods can operate directly only on class fields.
A static initializer declared in a class is executed when the class is initialized. static initializers can be used to initialize the class variables of the class together with any field initializers for class variables.
39. strictfp
Floating-point arithmetic can be evaluated in one of two ways: FP-strict or not FP-strict.
Executing code FP-strict produces the same result on all Java virtual machines. Executing code not FP-strict can use relaxed rules, possibly for optimizing performance, and may not give the same repeatable result on all Java virtual machines.
The strictfp modifier can be applied to a class, interface, or method.
Stictness is not inherited.
40. super
Enables a subclass to access overridden methods and hidden members of its superclass.
The super keyword is also used to forward a call from a constructor to a constructor in the superclass.
41. switch
A switch statement transfers control to one of several statements depending on the value of an expression.
42. synchronized
Synchronization is a mechanism for handling threads using monitors a thread can lock and unlock.
An instance method, a class method, or a group of statements can be synchronized.
Synchronized methods perform a lock action and if execution of the method's body is completed, either normally or abruptly, an unlock action is performed.
Reading and writing to volatile fields and using classes in the java.util.concurrent package provide additional ways of synchronization.
43. this
Used to represent the current instance of the class in which the keyword this appears.
this can also be used to forward a call from one constructor in a class to another constructor in the same class.
44. throw
throw causes the declared exception instance to be thrown.
This causes execution to continue with the first enclosing exception handler declared by the catch keyword to handle an assignment compatible exception type.
45. throws
The throws keyword is used in method declarations to specify which exceptions are not handled within the method but rather passed to the next higher level of the program.
All uncaught exceptions in a method that are not instances of RuntimeException must be declared using the throws keyword.
46. transient
transient declares that an instance field is not part of the default serialized form of an object.
When an object is serialized, only the values of its non-transient instance fields are included in the default serial representation.
47. try
A try statement executes a block of statements. If an exception is thrown and the try statement has one or more catch clauses that can catch it, control will be transferred to the first catch clause.
If the try statement has a finally clause, the finally block of code is executed, whether the try block completes normally or abruptly, and whether a catch clause is first passed control.
48. void
void is used in method declarations to specify the method does not return any value of any type.
49. volatile
The volatile keyword is used in field declarations to specify the variable is modified asynchronously by concurrently running threads. A thread that reads the value of a volatile field always sees the most recent value.
50. while
A while keyword is used to declare a loop that iterates a block of statements as long as a specified boolean expression is true.
The loop's exit condition is specified at the top of the loop using the while keyword with an associated boolean expression.
The loop evaluates the exit condition before executing the loop.
Note: true, false, and null are not keywords, they are literals for the types: boolean and null.