Short definitions and context plus an example where useful. Examples of age-old C constructs (like if-else, do-while, for, etc.) are not provided. Java keywords are in bold, fixed-space font but not in italics. General object oriented and other terms are in italics, bold and proportional-space font.
| A | B | C | D | E | F | I | L | M | N | O | P | R | S | T | V | W |
| A |
abstract refers to an abstract class containing at least one abstract method. If more than one method labeled abstract is present, the class must be itself labeled abstract. An abstract class is most often used to create other classes:
abstract class Instrument
{
public abstract void play( Note n );
public String what()
{
return "Instrument";
}
}
class Wind extends Instrument
{
public void play( Note n )
{
System.out.println("Wind.play() " + n);
}
public String what()
{
return "Wind";
}
}
|
| B |
bean a reusable software component written as a class in Java that conforms to a particular convention, to wit, that there is a no-argument constructor and it provides properties. A bean is often used to encapsulate multiple objects into one so that the bean is passed around rather than the separate objects. See managed bean.
public class GreetingBean implements java.io.Serializable
{
static final long serialVersionUID = 1L;
private String greeting;
public GreetingBean()
{
// this is the default greeting...
this.greeting = "Hello world!";
}
public String getGreeting()
{
return this.greeting;
}
public void setGreeting( String greeting )
{
this.greeting = greeting;
}
}
|
boolean a primitive type that can hold the values true or false.
break as in C except that it can be followed by the name of a label that, if it immediately preceeds the top of the loop, can specify the route of execution in order to branch beyond the loop context of the break:
DoItLoop :
while (done != true)
{
for (i = 0; i < 100; i++)
{
if (i == 3)
{
done = true;
break DoItLoop;
}
}
}
|
byte a primitive type capable of the values -128 to 127.
(return to top)| C |
case as in the C switch construct.
catch introduces code to handle an exception case.
char a Java character, which is basically UCS-2.
class as used in other OOP languages, class is the keyword for defining object types.
class Instrument
{
public void play( Note n )
{
System.out.println("Ta-daaaaaaa!");
}
public String what()
{
return "Instrument";
}
}
class Brass extends Instrument
{
public void play( Note n )
{
System.out.println("Brass.play() " + n + " loud and brash");
}
public String what()
{
return "Brass";
}
}
|
continue as in C except that, like break above, can be followed by a label name.
(return to top)| D |
default as in the C switch construct.
do-while as in the C construct.
double a primitive type capable of holding a 64-bit wide floating point number in IEEE 754 format.
(return to top)| E |
encapsulation refers to the bundling of data with the methods that manipulate or operate on it. This does not always mean to hide it (see information hiding).
extends indicates inheritance of a super- or parent class. In the following example, Brass inherits the properties of Instrument:
class Instrument
{
public void play( Note n )
{
System.out.println("Ta-daaaaaaa!");
}
public String what()
{
return "Instrument";
}
}
class Brass extends Instrument
{
public void play( Note n )
{
System.out.println("Brass.play() " + n + " loud and brash");
}
public String what()
{
return "Brass";
}
}
|
| F |
false (see boolean).
final indicates a variable or object, a method or a class that cannot be changed. Can create a manifest constant or, in the case of a “blank” final, can be initialized at a later point as appropriate.
private final int NIL = 0; public static final int HALVES = 2; final Shape pentagon = new Shape(5); private final starting_amount;
finally a keyword introducing a final execution clause to implement object clean-up for the class.
class Shape
{
Shape( int i )
{
System.out.println("Shape constructor");
}
void dispose()
{
System.out.println("Shape dispose");
}
}
public class CADSystem extends Shape
{
...
public static void main( String[] args )
{
Shape x = new Shape(47);
try
{
// code that implements the CAD system using Shape x...
}
finally
{
x.dispose();
}
}
}
|
float a primitive type capable of holding a 32-bit wide floating point number in IEEE 754 format.
for as in the C construct.
(return to top)| I |
if-else as in the C construct.
implements is a keyword that tells the Java compiler that you are implementing a defined interface in the present class.
interface class Instrument
{
void play( Note n );
String what();
}
class Percussion implements Instrument
{
public void play( Note n )
{
System.out.println("Percussion.play() " + n);
}
public String what()
{
return "Percussion";
}
}
|
import a Java directive to include definitions (and the class binary) from a library.
import java.util.*; import com.windofkeltia.locale;
information hiding a design principle by which information best hidden, but crucial to an implementation is kept away either to protect it from corruption or to keep consumers of an implementation from relying upon its details.
inheritance refers to the fact that a class “inherits” or acquires all the properties including data and methods of its super- or parent class.
int a primitive, signed-integer type 32 bits wide.
interface is a little bit like a template in C++ in that it defines a class, what it looks like, but doesn't implement it. See implements.
(return to top)| I |
JavaServer Faces (JSF) is a Java-based application framework that simplifies user interfaces in JEE (web) applications aiding in implementing the model-view-controller concepts. JSF uses JavaServer Pages (JSP) as its display technology.
JavaServer Pages (JSP) is a Java-based application technology that implements an unseen servlet dynamically generating HTML, XML or other documents in response to a web client request. Basically, Java code fragments are embedded inside an HTML or XML document that create the unseen servlet which runs in response usually to a hit from a client browser.
(return to top)| L |
listener a call-back or registered function that “listens” and performs a function at a certain point such as initialization or destruction. For example, an application can implement the ServletContextListener interface from javax.servlet. Then, the application knows when application start-up and shut-down occurs and can perform appropriate tasks. In the context of JSP and servlets, some listeners are signalled to the application deployment in web.xml.
long a primitive, signed-integer type 64 bits wide.
(return to top)| M |
main main entry point into a class when the class is actually executed. For classes not meant to be the starting point of execution, a main is nevertheless useful for testing purposes. main always takes a string of arguments.
package music;
public class Music
{
private static Test monitor = new Test();
public static void tune( Instrument i )
{
i.play( Note.MIDDLE_C );
}
public static void main( String[] args )
{
Wind flute = new Wind();
tune( flute );
monitor.expect( new String[] { "Wind.play() Middle C" } );
}
}
|
managed bean a bean that is managed by JavaServer Faces via descriptions inside faces-config.xml.
(return to top)| N |
new creates a new instance or object of a class.
(return to top)| O |
object is something that has “state”, “behavior” and “identity” including, in Java, internal data (state), methods (producing behavior) and compiler-recognized distinction (identity). Practically speaking, an object in Java is the instantiation of a formally defined class and is created by new and referred to via a reference defined in the usual way:
Shape polygon = new Shape(0);(return to top)
| P |
package is what becomes available via the import directive. It is a specially prepared library, either part of the Java distribution, your own or one you obtain from a third party.
polymorphism is the process of transforming existing classes into more complex and useful ones such that messages to those objects behave in ways distinctly appropriate to the class(es) to which they belong. E.g.: for a superclass polygon, its area method will be implemented correctly in each of all derived classes which could include triangle, rectangle, hexagon, etc.
private indicates to the compiler that none outside of the class or package is to know even of the very existence of the variable, object of class. A variable or object labeled static cannot be accessed by other classes in the same package and a class thus labeled is not visible outside the file.
protected like private except that inheriting classes are allowed to access the variable, object or class thus labeled.
public tells the compiler that the object (variable, class, etc.) is freely available to all who wish to consume it.
(return to top)| R |
return just as the C control directive.
(return to top)| S |
short a primitive type two bytes wide and able to hold values from -65536 through 65535.
static indicates there is to be exactly one copy of the variable or object named. Even if it's a field in a class, as many objects as are ever instantiated of that class, there will still only be one such field.
super represents the parent- or superclass.
switch as in the C construct.
synchronized is a keyword that creates an implied mutually exclusive lock to protect the variable or apparent code block using it.
public class Price
{
public synchronized double price;
public synchronized void setPrice( double newPrice )
{
price = newPrice;
}
public void main( String[] args )
{
double nextPrice = 0.00;
synchronized
{
p.price = newPrice;
}
}
}
(return to top)
| T |
this refers, in a case where it isn't obvious, to the current object; can be used only inside a non-static method. A compiler switch may be used to enforce the use of this even when it's unambigous.
class Apricot
{
void pick()
{
...
};
void pit()
{
pick(); // no need for this.pick()...
...
}
}
public class Leaf
{
int i = 0;
Leaf increment()
{
i++;
return this;
}
...
}
|
throws is an indication, for any method, of the exceptions it can be expected to throw.
true (see boolean).
try introduces a clause or block out of which a handled exception can be expected and that must be explicitly handled via a catch block.
(return to top)| V |
void is somewhat the same as in C except that there is a difference between returning void and not having a type to return.
volatile is a keyword to apply to the definition of a variable. If a variable (i.e.: field) is declared volatile, it is guaranteed that any thread accessing it will see the most recent value, but this is not accomplished via any mutually exclusive lock.
(return to top)| W |
while as in the C construct.