Unit-I Introduction To Class, Object and Methods
Unit-I Introduction To Class, Object and Methods
ENGINEERING
S.V.V.D.Jagadeesh
Sr. Assistant Professor
Dept of Artificial Intelligence & Data Science
LBRCE
Previous Discussion
History of Java
JDK, JRE and JVM
Java Compilation
Features (Buzzwords) of Java
Session Outcomes
Class
A class is a group of objects that has common properties. It is a
template or blueprint from which objects are created..
A class in java can contain:
data member
method
constructor
block
class and interface
Object
An entity that have state and behavior is called as object.
Ex: Chair, TV, table pent
Characteristic of Object:
State : represents the data of an object. (value)
Behavior : represents the behavior of an object (Functionality)
Identity: Object identity is typically implemented via a unique ID. The value
of the ID is not visible to the external user, but is used internally by the JVM
to identify each object uniquely.
Example: pen is an object name is Reynolds color is white etc., known as state.
Used for writing is its behavior.
Object is instance of the class. Class is a template or blueprint from which objects
are created.
OOP S.V.V.D.Jagadeesh Friday, July 26, 2024
LBRCE
Syntax of a class
class classname type methodname2(parameter-list)
{ {
type instance-variable1; // body of method
}
type instance-variable2; // ...
//.... type methodnameN(parameter-
type instance-variableN; list)
type methodname1(parameter-list) {
// body of method
{ }
// body of method }
}
OOP S.V.V.D.Jagadeesh Friday, July 26, 2024
LBRCE
Summary
Class
Object
Syntax of a class
Object Memory Representation
Creating an object for a class