abstract class |
A class containing an abstract method is an abstract class. Such a class must be explicitly declared as abstract. |
abstract class |
An abstract class cannot be instantiated. |
abstract class extending |
If a class extends an abstract class, it must define all the methods of the super class. Otherwise, it has to be declared abstract. |
abstract method |
A method declared without the body is an abstract method. Such a method has to be declared as Abstract |
add |
The add method for attaching GUI components is a Container class method and not of Component class. |
Applet writing to disk |
Java does not allow applets to write to local disk. |
Applet class |
The Applet class must be the super class of any applet that is to be embedded in a Web page or viewed by the Java Applet Viewer. |
applet i/o |
User I/O is not accomplished with Java’s stream I/O classes. |
applet i/o |
User I/O is accomplished with AWT or swing objects |
applet main() |
Applets do not need a main() method. |
APPLET tag |
The APPLET tag is used to start an applet from both an HTML document and from an applet viewer. |
array index checking |
Java checks array index during runtime. If program tries to use index out of bound, a runtime error occurs. |
array size |
When an array size (dimension) is specified, it cannot be changed later in the program. |
arrays methods |
Arrays are passed to methods by call-by-reference. |
Assignment |
You can assign a character variable to integer but not vice versa |
Bit-wise operator |
Bit-wise operators accept only integral operands (char, byte, short, int, and long ). Float and double are not allowed. |
Boolean type |
The Boolean type cannot be converted from or to any other data type. |
Boolean variable |
In Java, Boolean variable does not take the value 1 or 0; it takes true or false values only. |
break |
A break statement can be used only within loop or switch case statements. |
Bytecode |
The type of code generated by a Java compiler |
Character constant |
Character constant (literal) is formed by enclosing a single character in pair of single quotes. |
Checked Exceptions |
Only runtime exceptions (including its subclasses) are checked exceptions; all others are unchecked exceptions. |
Cloneable, Comparable and Runnable |
Interfaces defined by java.lang are Cloneable , Comparable , and Runnable. |
Cloneable |
A Cloneable interface defines no members. |
Collection framework |
Components of “Collection framework” are available in the package java.util |
Comma operator |
Java does not support the comma operator (of C++). |
command line arguments |
All command line arguments are passed as a string to method main. |
Comments |
Comments increase the readability of the program. |
Comments |
Comments have no relevance to program (execution) speed. |
const |
In Java const is a reserved word, reserved for future use. |
constructor |
Constructors do not have a return type. |
constructor |
Name of the constructor is same as that of the class. |
constructor |
Constructors can be overloaded. |
constructor |
A class constructor may have public or protected keyword before them, nothing else. |
constructor |
constructor is a method is used to initialize the instance variable of a class. |
container event |
Container event class is generated when a component is added to or removed from a container. |
cv for |
The control variable declared in for loop is visible only within the scope of the loop. But in C/C++, it is visible even after the loop is exited. |
Default constructor |
If class definition does not contain a constructor, the compiler provides a default constructor which initializes all data members to null values. |
do-while |
do-while loop construct will always be executed at least once. |
escape codes |
In Java, there are no escape codes defined for vertical tab and the bell character. |
Exception |
An Exception is an abnormal condition that disrupts normal program flow. |
Exception class |
The root class of all the exception classes is the Exception class. |
expression statement |
Only certain types of expressions are allowed in expression statement. They are assignment, inc/dec , and method call . |
Expressions |
Expressions are combinations of variables, keywords or symbols that evaluate to a value of some type. |
final |
A final variable cannot change from its initialized value. |
final class |
A class declared final cannot be sub-classed. |
final method |
A method declared as final cannot be overridden. |
finalize() |
Method finalize() is called before an unused object is recycled. |
finally |
When a finally block is present, it is always executed irrespective of occurrence of exception. |
finally |
A finally block is optional. |
for loop |
The second expression in for statement must be a Boolean expression. As a special case, it can be a blank expression which is considered as having value “true”. |
functions |
Every function in Java must be a member of some class. Java uses term method for such member functions. |
Garbage collection |
When all references to an object are gone, the memory used by the object is automatically reclaimed. |
graphics |
Graphic class is defined in java.awt package. |
Implements |
A class can use an interface by using the Implements clause. |
import |
Java by default imports package java.lang . We do not have to import it specifically. |
import statement |
Import statement must come before all other statements except package statement. |
in |
The object “in” belongs to class InputStream . It is standard input stream. |
in, out, err |
In, out , and err are predefined stream variables. |
Inheritance |
Inheritance is a mechanism that enables one class to inherit in general the behavior and attributes of another class. But we cannot say that it inherits all the behavior and attributes. |
Initialization |
Initialization can happen only ones in the applets lifetime. However, currently this rule has changed. |
initialization of class variable |
JVM automatically initializes every numeric instance of class variable. |
inner |
Objects declared within the inner scope will not be visible outside it |
inputStream |
Abstract class inputStream is the super class of all classes used for reading bytes. |
Instantiation exception |
Instantiation exception means an attempt to create an abstract class or interface. |
interface |
A class can have more than one interface. |
interface |
An interface can extend any number of interfaces, |
Java-compatible browser |
Applets should be run under a Java-compatible browser. |
Javax.swing |
Javax.swing is the high-level swing package, and primarily consists of components, adapters, default component models and interfaces for all the delegates and models. |
Join() |
The join() method suspends the current thread until that thread object dies. |
Jpanel |
Jpanel is a Container. |
Key events |
Key events are generated when a user presses or releases a key on the keyboard. |
keywords currently in use |
|
keywords which are values defined |
false null true |
keywords reserved for future use |
const goto |
labelled break labelled continue |
Labelled break and labelled continue statements are allowed in Java. |
labeled break labeled continue |
Labelled break and labelled continue statements must be inside the loop so labelled. |
long |
The number of bytes used by Java primitive long is 8. |
main() |
Java applications begin execution at method main() . |
Main() |
Main() is a class method, not an object method. |
method interface |
Methods declared in interface must be declared public in class definition. |
method interface |
Any normal class (non Abstract ) must fully define all the methods declared in the interface. |
modulo division |
Modulo divisor operator can be used with floating point values in Java. This is not allowed in C/C++. |
monitor |
The sleep() method tells the calling thread to give up monitor until some other thread enters the same monitor. |
multiple inheritance |
Java does not allow multiple inheritances, where a class has more than one super class. |
multiple inheritances |
Java allows multiple inheritances by means of interfaces. |
multiple listeners |
A component can have multiple listeners for events of different type. |
native |
The native keyword indicates that the method is implemented in another language like C/C++. |
NORM_PRIORITY |
NORM_PRIORITY is the default priority of a newly created thread. |
object class |
By default, classes inherit from the Object class, which is a super class of all classes in the Java class hierarchy. |
out |
The object out ” belongs to class printStream . It is standard output stream. |
overloading |
A method with a given name in a class can have different signatures. Such methods are said to be overloaded. |
overloading |
A method in a class cannot have two definitions with same signature, even if return types are different. |
override |
A method is overridden when another method with the same signature is declared in a subclass. |
override |
A final method cannot be overridden |
package statement |
If any program contains package statement, it has to be the first statement. |
parameter passing |
Basic parameter passing in Java is call-by-value. All simple types are passed by call-by-value. However, all aggregate types effectively get passed by call-by-reference |
parseInt |
The method is used to convert String to an integer, assuming that the String represents an integer. |
preemptive switching |
A thread priority is used to decide when to move from one running thread to the next. This is called preemptive switching. |
program file name |
A simple Java application source file must have extension java . The name of the file and the name of the public class must be identical (case sensitive) |
RadioButtons |
RadioButtons are implemented in swing through the JRadioButtons class. |
Reader |
Abstract class Reader is the super class of all classes used for reading characters. |
Relational expressions |
Relational expressions return Boolean value. Note: C++ returns int . |
return statement |
If return type of a method is void, return statement is optional. For any other return type, it is compulsory. |
Set |
Set is a collection interface used to maintain unique elements. |
Sleep() |
The sleep() method is used to temporarily stop the execution of the thread. |
source file public class |
If a source file includes a public class, the class name must match the unextended filename. In other words, there cannot be two public classes in a single source file. |
Stack overflow Runtime exception |
Stack overflow is an example of Runtime exception. |
Start() |
After the start() method is called, the thread is in a Runnable state. |
static for local variables. |
Keyword static not allowed for local variables of any method. |
static method |
A static method cannot make a reference to non-static variables of a class. |
static method |
When a method is made static, it cannot use keywords this or super . |
static variable |
A static variable indicates that there is only one copy of that variable. |
String operators |
Strings cannot be lexicographically compared using operators like > or <= . |
string constant |
String constant (literal) is formed by enclosing a zero or more characters in pair of double quotes. |
String immutable |
Strings in Java are immutable, meaning they cannot be changed. The methods which appear to modify a given string actually return a new (separate) string. |
StringBuffer |
When no specific buffer length is requested, StringBuffer allocates room for 16 additional characters. |
StringBuffer mutable |
Objects of class StringBuffer are very much like strings. However, they are mutable (can be modified). |
sub-class variable |
Sub-class reference variable cannot be assigned a super-class reference value |
sub-class constructor |
Every constructor of a sub class must have a call to super class constructor as a first statement. Only exception is when super-class has no constructor or has a default constructor (one without parameters). |
super-class variable |
Super-class reference variable can be assigned a sub-class reference value |
switch default |
Default clause is optional in Java |
switch expression |
Switch expression can be of basic type byte, short, int , or char. It can be also be Wrapper class type like Character, Byte, Short , or Integer . It can be also of any enumerated type. |
synchronized |
Every object that has synchronized methods has a monitor. |
thread class |
By using a thread class, multithreaded program can be created. |
Thread priority |
Threads may yield to threads of lower priority. |
Thread simultaneous access |
It is possible for two threads to access the same variable or the same method of same object at same time. However, the net result will be unpredictable. |
throw |
A throw statement causes an exception to be thrown. |
throws |
A special clause called throws is used in method definition to indicate that a method may possibly throw an exception. |
trim() String |
String method trim() returns a new String object in which all white-space characters have been removed from the beginning and end of a string. |
try |
A try block must be followed by a catch block. Catch block need not be present if finally block is present. |
Unicode character |
Unicode character can be expressed as u followed by four hexadecimal digits. Note character u is in lowercase. There must be exactly four digits no more any less. |
Unsigned |
Integer types are always signed in Java. There is no unsigned qualifier in Java. |
variable initialization |
Java flags compilation error if one tries to use ordinary variables without initialization. |
variable name |
A variable name can contain as well as start with character $ . |
variables interface |
Variables in interface must be declared as final. |
Vector |
Elements of the vector can only be objects. Simple data types like integers are not allowed as elements. |
Vector size() |
The size() method determines the number of elements in Vector (not sizeOf() ). |
void |
In Java if method does not return any value, then it must be declared as void. |
Web page |
To change Web page background colours, use the BGCOLOR attribute in the <BODY> tag. |
Writer |
Abstract class Writer is the super-class of all classes used for writing characters. |