Java Basics For Beginners - 01 Class | Interface | Abstract Class
Basic Building Blocks of Java
Class
Class is the blueprint of an object. Let's explain this from a real-world example. For that, we will consider the Fish category. Fish is a common category it has specific behaviors and states. In the real world, we can see the implementation of Fish such as TankCleaners, Goldfish, and so on. This Fish is virtual and has specific behaviors and states but has no implementation of the behaviors. We cannot define the implementation of Fish behaviors because it is common. In java to define those virtual things, we use Interfaces. We cannot build an active object from the Interfaces. It is as we cannot find Fish in the real world there are only TacnkCleaners, GoldFish, and so on.
In java to define the structure of real-world existing things, we use class.
class is a keyword in java that is used to create a blueprint of an object.
Syntax to Create a class in Java
- Java class name should be a noun in UpperCamelCase, with the first letter of every word capitalized. Ex: GoldFish
- Class name also called as identifier in java identifier cannot begin with number.

Comments
Post a Comment