Abstract Class | Concrete Class |
1. An abstract class cannot be used to instantiate objects. | 1. Concrete class can be used to instantiate objects. |
2. An abstract class may have one or more subclasses but never an instance | 2. Concrete class may have subclasses and instances. |
3. Typically an abstract class has one ore more abstract methods. | 3. A concrete class doesn’t have any abstract method. |
Applets | Servlets |
1. Applets are Java programs that can be embedded in HTML documents. | 1. Servlets are Java programs that generate content for web pages. |
2. Applets run on Java enabled web browsers. | 2. Servlets run on Java enabled web servers. |
3. Java applets tend to be small programs and are often used to add visual or multimedia effects to web pages. | 3. Servlets generate HTML documents that are sent to the client browsers for display. For example, servlets can be used to process an HTML form submitted by a web client and to generate a response page. |
Array | Vector |
1. An array can contain only one type of data. | 1. A Vector can contain references of any type of objects. |
2. An array has a fixed size. | 2. Size of the Vector can change as needed. |
Class Variable (static variable) | Instance Variable (non-static variable) |
1. Only one copy of a class variable is shared by all objects of a class | 1. Every object has its own copy of all the instance variable of the class |
2. A class variable represents class wide information (same to all objects). | 2. An instance variable represents information of only one object. |
3. A class variable can be accessed through a reference to any object of the class or by qualifying the variable name with the class name and a dot (.). | 3. An instance variable can only be accessed through a reference to any object of the class |
4. A class variable exists even when no object of the class exists- it is available as soon as the class is loaded into memory at execution time. | 4. An instance variable exists only when an object of the class exists. |
5. A class variable can be accessed from both the static and non-static context. | 5. An instance variable can only be accessed from the non-static context. |
Reference: H.M. Deitel and P.J. Deitel (2005) Java How to Program |
Primitive Types | Reference Types |
1. Primitive types are the fundamental, built in (as keyword) types | 1. Reference types are constructed from primitive types either through class definition, interface definition or the use of arrays. |
2. A variable of any primitive type contains a single value of the appropriate size and format. | 2. A variable of a reference type holds a null reference or a reference to an instance of a class |
3. Values of these types cannot be decomposed | 3. A reference type can be decomposed into several values. |