Class:
- Class is a Template or BluePrint or set of instructions to build a specific type of object.
- Class doesn't hold any memory.
- Class is a Logical Entity.
- Class in java determines how an object will behave and what the object will contain.
- Class names must begin with a letter, the dollar sign ($), or an underscore character (_). They cannot start with a digit.
- Source file name must exactly match the class name.
- Class names should be written in PascalCase (also known as UpperCamelCase). The first letter of the class name and the first letter of each subsequent internal word should be capitalized(Ex: MyClassName).
- Name can contain numbers only in the middle and at the end.
- Java is case-sensitive, so MyClassName and myclassname are treated as two different names.
Object:
- Object is a Physical Entity or Real-time Entity.
- Object represents Class.
- Object is memory reference of a class.
- Object is a member of a class.
- Object is an instance of a class.
- Object is combination of state and behaviours.
- The state of an object is stored in a field or variable.
- The behaviour of an object is defined by methods.
- Objects are created at runtime from templates, which are also know as classes.
- Object name should follow lowercamelcase.(Ex: className)
Data Types:
Primitive Data Types:
- byte - 1 byte - Stores whole numbers from -128 to 127.
- short - 2 bytes - Stores whole numbers from -32,768 to 32,767.
- int - 4 bytes - Stores whole numbers from -2,147,483,648 to 2,147,483,647.
- long - 8 bytes - Stores whole numbers from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.
- float - 4 bytes - Stores fractional numbers. Sufficient for storing 6 to 7 decimal digits.
- double - 8 bytes - Stores fractional numbers. Sufficient for storing 15 decimal digits.
- boolean - 1 bit - Stores true or false values.
- char - 2 bytes - Stores a single character.
Non Primitive Data Type:
String - It is used to store text(set of characters). It is an object of a class Syring.


Top comments (0)