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 GoldFish { String color ; public void swim (){ System . out . println ( "Gold fish swim in this way..." ); ...