SlideShare a Scribd company logo
3
Most read
4
Most read
10
Most read
S.SANDHIYA-181611
P.DHIVYA-181602
S.B.K COLLEGE
ARUPPUKOTTAI
To
K.Padma priya M.Sc,M.Phill
Dep of maths (CA)
SBK College ,
ARUPPUKOTTAI
Classes,object and methods java
Definition of class
and objects:
 JAVA program must be encapsulated
in class that defines the state and
behaviour of the basic components
known as objects classes create
object and objects use methods to
communicate between them.
In JAVA the data items are called
fields and functions are called
methods.
Defining a class:
Class is a were defined data
type.once the class type has been
defined then we create variables of
type using declaration syntax.
Class class name{extends superclass}
Class classname{extends
superclassname}
{
{variable declaration}
Adding variables:
 Data is encapsulation in class by
placing data field inside the body of
class def.These variables are known
ass instance variables.we can declare
the instance variables exactly the
same way to declare the local
variables.
Eg:
Class Rectangle
{
int lenth;
int width;
}
Class rectangle containss the two integer
type instance variables.It allowed to
declare them in one line.
int length,width;
Instance variable also known as
member variables.
Adding methods:
A class with only data field has no
file.We must add methods that are
necessary for manipulating the data
contained in the class.Methods are
declared inside the body of the
class.syntax,
Type
methodname(parrameter list)
{
Creating objects:
Object in JAVA is a block of memory
that contains space to store all the
instance variables.Creating an object
is also referred to infantiating an
object.
Rectangle rect1;
rect1=new Rectangle();
Accessing class
members:
 We created objects each containing
its own set of variables and assign
values to these variables in order to
use our program.All variables must be
assigned values before they are used.
 We cannot access the instance
variables and the methods directly.
Objectname.variable
name
This again can be done in two ways.
The first approach is to access the
instance variables using the dot
operator and compute the area.That
is,
 Int
area1=rect1.length*rect1.width;
The second approach is to call the
method rectArea declared inside the
class.That is,
int area1=rect1.rectarea();
Constructors:
JAVA supports a special type of
method called a constructor,that
enables an oobject to initialize itself
when it is created.
Constructors have the same name as
the class itself.secondly,they do not
specify a return type,not even
void.this is because they return the
instance of the class itself.
Methods overloading:
 JAVA to create methods that have
the same,but different parameter list
and different definitions.This is called
method overloading.
 JAVA matches up the method name
first and then the number and type of
parameter to decide which one of the
definites to excute.This process is
known as polymorphism.
Static members:
Class basically contains two sections.
One declares variables and the other
declares methods.These variables and
methods are called is instance
variables and instance methods.
Member can be defined as follows,
static int count;
static int max(int x,int y);
Nested of methods:
The class nesting defines one
constructor and two methods,namely
largest( )and display ( ) calls the
method largest( ) to determine the
largest of the two numbers and then
displays the result.

More Related Content

What's hot (20)

PPTX
this keyword in Java.pptx
ParvizMirzayev2
 
PPTX
JAVA AWT
shanmuga rajan
 
PPTX
Constructors and Destructor in C++
International Institute of Information Technology (I²IT)
 
PPTX
Java exception handling
BHUVIJAYAVELU
 
PPT
Final keyword in java
Lovely Professional University
 
PPTX
Classes, objects in JAVA
Abhilash Nair
 
PPTX
Strings in Java
Abhilash Nair
 
PPTX
classes and objects in C++
HalaiHansaika
 
PPTX
Access modifiers in java
Madishetty Prathibha
 
PPTX
Constructor in java
Pavith Gunasekara
 
PPTX
Inheritance in java
Tech_MX
 
PPTX
Basic Concepts of OOPs (Object Oriented Programming in Java)
Michelle Anne Meralpis
 
PDF
Java threads
Prabhakaran V M
 
PPTX
Operators in java
Then Murugeshwari
 
PDF
Generics
Ravi_Kant_Sahu
 
PPS
Java Exception handling
kamal kotecha
 
PDF
Strings in java
Kuppusamy P
 
PPTX
Pointers in c++
sai tarlekar
 
PDF
Methods in Java
Jussi Pohjolainen
 
this keyword in Java.pptx
ParvizMirzayev2
 
JAVA AWT
shanmuga rajan
 
Java exception handling
BHUVIJAYAVELU
 
Final keyword in java
Lovely Professional University
 
Classes, objects in JAVA
Abhilash Nair
 
Strings in Java
Abhilash Nair
 
classes and objects in C++
HalaiHansaika
 
Access modifiers in java
Madishetty Prathibha
 
Constructor in java
Pavith Gunasekara
 
Inheritance in java
Tech_MX
 
Basic Concepts of OOPs (Object Oriented Programming in Java)
Michelle Anne Meralpis
 
Java threads
Prabhakaran V M
 
Operators in java
Then Murugeshwari
 
Generics
Ravi_Kant_Sahu
 
Java Exception handling
kamal kotecha
 
Strings in java
Kuppusamy P
 
Pointers in c++
sai tarlekar
 
Methods in Java
Jussi Pohjolainen
 

Similar to Classes,object and methods java (20)

PPTX
Ch-2ppt.pptx
ssuser8347a1
 
PPTX
classes-objects in oops java-201023154255.pptx
janetvidyaanancys
 
PPTX
1707325642974_Classes fffand objects.pptx
nandemprasanna
 
PPT
Classes & objects new
lykado0dles
 
PPTX
C# classes objects
Dr.Neeraj Kumar Pandey
 
PPTX
Classes,object and methods jav
Padma Kannan
 
PPT
packages and interfaces
madhavi patil
 
PPTX
Chapter 3
siragezeynu
 
PPTX
702641313-CS3391-OBJORIENTEDPS-Unit-2.pptx
SAJITHABANUS
 
PDF
Wrapper classes
simarsimmygrewal
 
PDF
Java defining classes
Mehdi Ali Soltani
 
DOC
Delphi qa
sandy14234
 
PPTX
Hemajava
SangeethaSasi1
 
PPT
4 Classes & Objects
Praveen M Jigajinni
 
PPT
Reflection
Piyush Mittal
 
PPT
Ap Power Point Chpt4
dplunkett
 
PPT
classandobjectunit2-150824133722-lva1-app6891.ppt
manomkpsg
 
PDF
Object Oriented Principles
Sujit Majety
 
PPTX
UNIT-2.pptx CS3391 Inheritance , types, packages and Interfaces
SakkaravarthiS1
 
PPT
3 functions and class
trixiacruz
 
Ch-2ppt.pptx
ssuser8347a1
 
classes-objects in oops java-201023154255.pptx
janetvidyaanancys
 
1707325642974_Classes fffand objects.pptx
nandemprasanna
 
Classes & objects new
lykado0dles
 
C# classes objects
Dr.Neeraj Kumar Pandey
 
Classes,object and methods jav
Padma Kannan
 
packages and interfaces
madhavi patil
 
Chapter 3
siragezeynu
 
702641313-CS3391-OBJORIENTEDPS-Unit-2.pptx
SAJITHABANUS
 
Wrapper classes
simarsimmygrewal
 
Java defining classes
Mehdi Ali Soltani
 
Delphi qa
sandy14234
 
Hemajava
SangeethaSasi1
 
4 Classes & Objects
Praveen M Jigajinni
 
Reflection
Piyush Mittal
 
Ap Power Point Chpt4
dplunkett
 
classandobjectunit2-150824133722-lva1-app6891.ppt
manomkpsg
 
Object Oriented Principles
Sujit Majety
 
UNIT-2.pptx CS3391 Inheritance , types, packages and Interfaces
SakkaravarthiS1
 
3 functions and class
trixiacruz
 
Ad

More from Padma Kannan (13)

PPTX
B tree
Padma Kannan
 
PDF
Operators in C++
Padma Kannan
 
PPTX
Java packags
Padma Kannan
 
PPTX
Java and c++
Padma Kannan
 
PDF
Inheritance
Padma Kannan
 
PPTX
Functions in c++
Padma Kannan
 
PPTX
Functions in c++,
Padma Kannan
 
PPTX
Functions of dbms
Padma Kannan
 
PPTX
Basic concept of oops
Padma Kannan
 
PPTX
LEARNING BASES OF ACTICITY
Padma Kannan
 
PPTX
Social networking risks
Padma Kannan
 
PDF
Inheritance
Padma Kannan
 
PPT
Excel2002
Padma Kannan
 
B tree
Padma Kannan
 
Operators in C++
Padma Kannan
 
Java packags
Padma Kannan
 
Java and c++
Padma Kannan
 
Inheritance
Padma Kannan
 
Functions in c++
Padma Kannan
 
Functions in c++,
Padma Kannan
 
Functions of dbms
Padma Kannan
 
Basic concept of oops
Padma Kannan
 
LEARNING BASES OF ACTICITY
Padma Kannan
 
Social networking risks
Padma Kannan
 
Inheritance
Padma Kannan
 
Excel2002
Padma Kannan
 
Ad

Recently uploaded (20)

PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
PPTX
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
Mastering ODC + Okta Configuration - Chennai OSUG
HathiMaryA
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
“Squinting Vision Pipelines: Detecting and Correcting Errors in Vision Models...
Edge AI and Vision Alliance
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 

Classes,object and methods java

  • 1. S.SANDHIYA-181611 P.DHIVYA-181602 S.B.K COLLEGE ARUPPUKOTTAI To K.Padma priya M.Sc,M.Phill Dep of maths (CA) SBK College , ARUPPUKOTTAI
  • 3. Definition of class and objects:  JAVA program must be encapsulated in class that defines the state and behaviour of the basic components known as objects classes create object and objects use methods to communicate between them. In JAVA the data items are called fields and functions are called methods.
  • 4. Defining a class: Class is a were defined data type.once the class type has been defined then we create variables of type using declaration syntax. Class class name{extends superclass} Class classname{extends superclassname} { {variable declaration}
  • 5. Adding variables:  Data is encapsulation in class by placing data field inside the body of class def.These variables are known ass instance variables.we can declare the instance variables exactly the same way to declare the local variables.
  • 6. Eg: Class Rectangle { int lenth; int width; } Class rectangle containss the two integer type instance variables.It allowed to declare them in one line. int length,width; Instance variable also known as member variables.
  • 7. Adding methods: A class with only data field has no file.We must add methods that are necessary for manipulating the data contained in the class.Methods are declared inside the body of the class.syntax, Type methodname(parrameter list) {
  • 8. Creating objects: Object in JAVA is a block of memory that contains space to store all the instance variables.Creating an object is also referred to infantiating an object. Rectangle rect1; rect1=new Rectangle();
  • 9. Accessing class members:  We created objects each containing its own set of variables and assign values to these variables in order to use our program.All variables must be assigned values before they are used.  We cannot access the instance variables and the methods directly. Objectname.variable name
  • 10. This again can be done in two ways. The first approach is to access the instance variables using the dot operator and compute the area.That is,  Int area1=rect1.length*rect1.width; The second approach is to call the method rectArea declared inside the class.That is, int area1=rect1.rectarea();
  • 11. Constructors: JAVA supports a special type of method called a constructor,that enables an oobject to initialize itself when it is created. Constructors have the same name as the class itself.secondly,they do not specify a return type,not even void.this is because they return the instance of the class itself.
  • 12. Methods overloading:  JAVA to create methods that have the same,but different parameter list and different definitions.This is called method overloading.  JAVA matches up the method name first and then the number and type of parameter to decide which one of the definites to excute.This process is known as polymorphism.
  • 13. Static members: Class basically contains two sections. One declares variables and the other declares methods.These variables and methods are called is instance variables and instance methods. Member can be defined as follows, static int count; static int max(int x,int y);
  • 14. Nested of methods: The class nesting defines one constructor and two methods,namely largest( )and display ( ) calls the method largest( ) to determine the largest of the two numbers and then displays the result.