Disclaimer: This article might include affiliate links through which I could earn a modest commission, without any additional cost to you. I assure you, I only endorse tools I've thoroughly evaluated myself, and the reviews reflect my genuine opinions. Your support is greatly appreciated.

in

Know Here What Does “Class” in Programming Means!

Familiar with data types like int, long, float?
If Yes, Then what is the limitation of these data types?
You got it right, they can only hold one type of data, i.e. and int can store integer values, a float can only store floating point values.
Question comes to our mind, how do we represent user defined types e.g. Person which can have a String name, a long phone number and an int age.
Class in java is way to go concept as it is used to create user defined types.
Benefit of user defined type is that it can combine and store multiple type and gives you the power to create a user defined type for anything in the real world.
We can divide them into two categories:

  • JDK or System Class – They are those which comes along with JDK e.g. java.lang.String , java.lang.Thread
  • Application Class-They are those which you create in your Java Program or application eg. Person, Student etc

Class in java is created using the keyword “class”
Except holding code for variables e.g. age, name and phone and methods e.g. getName(), class doesn’t do anything.
Real magic starts when you create object of class. As to represent every single person e.g. You,me and your friend are object of Person, they have different name, age and phone number but they are Person.
Object are actual thing which is created from blueprint called class. Just like the cars including BMW, Mercedes and Audi has blueprint and follow specification, every object follows structure defined in class.
In object-oriented programming, a class is a program code for creating objects, providing initial values for state and implementations of behaviour. In many languages, the class name is used as the name for the class, the name for the default constructor of the, and as the type of objects generated by instantiating the class; these distinct concepts are easily conflated.
An object when created by a constructor of the class, the resulting object is called an instance of the class, and the member variables specific to the object are called instance variables, to contrast with the class variables shared across the class.
Thus, an object is a specific instance of a class; it contains real values instead of variables.
The class is one of the defining ideas of object-oriented programming. Among the important ideas about classes are:

  • A class can have subclasses which inherit all or some of the characteristics of the class. In relation to each subclass, the class becomes the superclass.
  • Subclasses can also define their own methods and variables that may or may not be a part of their superclass.
  • The structure of a class and its subclasses is called its class hierarchy.

 
 
 
 
 

Written by Bidyut Bikash Dhar

Bidyut Bikash Dhar is a proficient Digital Marketing & Online Branding Strategist, Mentor, and Inbound Marketing Specialist with a focus on Reputation Management, International Healthcare Marketing, and Medical Tourism. His expertise encompasses a wide array of areas, including Digital Marketing, Lead Generation, and Conversion Optimization. Bidyut excels in Search Engine Marketing, leveraging his skills to enhance online visibility and drive targeted traffic. With a passion for innovation and a dedication to excellence, he crafts strategic solutions to elevate brands and amplify their online presence. Bidyut's commitment to mentorship and his extensive experience in healthcare marketing make him a valuable asset to businesses seeking to expand their reach and impact in the digital landscape.

Leave a Reply

Your email address will not be published. Required fields are marked *

GIPHY App Key not set. Please check settings

Top 10 ranked Auto Insurance Companies to Supplement your Car Ride!

Top 10 Best Windows Software You Must have in Your Laptop