CLASSES AND
OBJECT
A.Sangeetha M.Sc(info Tech)
Department Of Cs&it
Nadar Saraswathi College Of Arts And Science
INTRODECTION:
 Java is a true OO language and therefore the underlying
structure of all Java programs is classes.
 „Anything we wish to represent in Java must be encapsulated in
a class that defines the “state "and “behaviour”of
the basic program components known as objects.
 „C lasses create objects and objects use methods to
communicate between them.
CLASS:
A class is a collection of fields (data) and
method (procedure or function) that
operate on that data
child
Centre
radius
Circumference()
Radius()
A classes is a collection of
fields(data)and methods (procedure
or function)that operate on that
data.
class Cl a s s N a m e
[extends
Su p e r Cl a s s N a m e ]
{
[fields declaration]
[methods declaration]
}
Bare bone class-no fields,no method.
A class with only data fields has no life.
Objects created by such a class cannot
respond to any messages.
public class Circle {
// my circle class
}
Methods are declared inside the body of the
class but immediately after the declaration of
data fields.
„The general form of a method declaration is:
type Method
Name(parameter-list)
{
Method-body;
 Objects are created dynamically using the
Java
Java
Java
Java
Java
Java
Java
Java
Java
Java
Java
Java
Java
Java
Java

Java

  • 1.
    CLASSES AND OBJECT A.Sangeetha M.Sc(infoTech) Department Of Cs&it Nadar Saraswathi College Of Arts And Science
  • 2.
    INTRODECTION:  Java isa true OO language and therefore the underlying structure of all Java programs is classes.  „Anything we wish to represent in Java must be encapsulated in a class that defines the “state "and “behaviour”of the basic program components known as objects.  „C lasses create objects and objects use methods to communicate between them.
  • 3.
    CLASS: A class isa collection of fields (data) and method (procedure or function) that operate on that data child Centre radius Circumference() Radius()
  • 4.
    A classes isa collection of fields(data)and methods (procedure or function)that operate on that data. class Cl a s s N a m e [extends Su p e r Cl a s s N a m e ] { [fields declaration] [methods declaration] }
  • 5.
    Bare bone class-nofields,no method. A class with only data fields has no life. Objects created by such a class cannot respond to any messages. public class Circle { // my circle class }
  • 6.
    Methods are declaredinside the body of the class but immediately after the declaration of data fields. „The general form of a method declaration is: type Method Name(parameter-list) { Method-body;
  • 7.
     Objects arecreated dynamically using the