BASIC CONCEPTS OF JAVA - nisarulhassan/learning-java GitHub Wiki
(1) WHAT IS OBJECT IN JAVA? A object in java is a set of data combined with methods for manipulating that data. An object is single entity of a class. A class is a group of intities.
(2) WHAT IS CLASS IN JAVA? A class is the context of java are templates that are use to create objects and to define data types and methods. Core properties include the data types and methods that may be used by the objects.
(3) WHAT IS DIFFERENCE BETWEEN CLASS AND OBJECT IN JAVA?
The term class and object are definitely related to one another but each term holds its own distinct meanings.
(i) CLASS.
The term class refers to the actual written piece of code which is used to define the behavior of any given class.
so a class is a static piece of code that consist of attributes which do not change during the exicution of a program.
(ii) OBJECT.
The term object refers to an actual instance of class. Every object must belong to a class
All class objects should have basic class properties. Classes are categories and objects are items within each category.
(4) WHAT IS DIFFERENCE BETWEEN PRIMITIVE AND NON-PRIMITIVE DATA TYPES IN JAVA?
(i) PRIMITIVE DATA TYPES.
Primitive data types are all defined by the language specification are standrad across all platforms and
their value is merely a number.
(1) BOOLEAN
(2) BYTE
(3) SHORT
(4) CHAR
(5) INTEGER
(6) LONG
(7) FLOAT
(8) DOUBLE
(ii) NON-PRIMITIVE DATA TYPES.
Non-primitive are Those which include class based types or array types. The value assigned to
variable of reference type will be a reference to an object.