Java – Basic Language Elelemnts

In java we have 6 basic programming elements to develop below are 6 types of applications. Below diagram shows the 6 basic programming elements hierarchy


Package- it is a java folder used to group related classes, interfaces and enums also used to seperate new classes from existed classes if both have same name.

2. class
3. interface - All these three are java files used to group Java data and logic. enum was introduced in Java 5.
4. enum

5. Variable - it is a named memory location used to store Java data, such as numbers, characters, string etc.

6. Method - It is sub block of a class used to implement logic of an object operations.

What is the difference between class, interface and enum ?

Interface is fully unimplemented class, it is used for defining set object operations, where as the class is a fully implemented class, it is used for implementing an object operations.

So interface does not allow methods with logic but class allows methods with logic.

For example: Bank is the object created as interface in java and HDFCBank , ICICIBank are created as classes with bank operations withdraw, deposit implementations.

Leave a Comment

%d bloggers like this: