SlideShare una empresa de Scribd logo
1 de 14
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
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.

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

String and string buffer
String and string bufferString and string buffer
String and string buffer
 
Constructor and Types of Constructors
Constructor and Types of ConstructorsConstructor and Types of Constructors
Constructor and Types of Constructors
 
Pure virtual function and abstract class
Pure virtual function and abstract classPure virtual function and abstract class
Pure virtual function and abstract class
 
Oops concept on c#
Oops concept on c#Oops concept on c#
Oops concept on c#
 
Operator overloading
Operator overloadingOperator overloading
Operator overloading
 
Java Basics
Java BasicsJava Basics
Java Basics
 
Synchronization.37
Synchronization.37Synchronization.37
Synchronization.37
 
Abstract class and Interface
Abstract class and InterfaceAbstract class and Interface
Abstract class and Interface
 
Introduction to package in java
Introduction to package in javaIntroduction to package in java
Introduction to package in java
 
Introduction to class in java
Introduction to class in javaIntroduction to class in java
Introduction to class in java
 
Java Thread Synchronization
Java Thread SynchronizationJava Thread Synchronization
Java Thread Synchronization
 
Ppt on this and super keyword
Ppt on this and super keywordPpt on this and super keyword
Ppt on this and super keyword
 
Java abstract class & abstract methods
Java abstract class & abstract methodsJava abstract class & abstract methods
Java abstract class & abstract methods
 
Python-Inheritance.pptx
Python-Inheritance.pptxPython-Inheritance.pptx
Python-Inheritance.pptx
 
9. Input Output in java
9. Input Output in java9. Input Output in java
9. Input Output in java
 
Data types in java
Data types in javaData types in java
Data types in java
 
Static keyword ppt
Static keyword pptStatic keyword ppt
Static keyword ppt
 
Static Data Members and Member Functions
Static Data Members and Member FunctionsStatic Data Members and Member Functions
Static Data Members and Member Functions
 
Packages
PackagesPackages
Packages
 
Java - Interfaces & Packages
Java - Interfaces & PackagesJava - Interfaces & Packages
Java - Interfaces & Packages
 

Similar a Classes,object and methods java

Classes & objects new
Classes & objects newClasses & objects new
Classes & objects newlykado0dles
 
Classes,object and methods jav
Classes,object and methods javClasses,object and methods jav
Classes,object and methods javPadma Kannan
 
packages and interfaces
packages and interfacespackages and interfaces
packages and interfacesmadhavi patil
 
Classes, objects in JAVA
Classes, objects in JAVAClasses, objects in JAVA
Classes, objects in JAVAAbhilash Nair
 
Ap Power Point Chpt4
Ap Power Point Chpt4Ap Power Point Chpt4
Ap Power Point Chpt4dplunkett
 
classandobjectunit2-150824133722-lva1-app6891.ppt
classandobjectunit2-150824133722-lva1-app6891.pptclassandobjectunit2-150824133722-lva1-app6891.ppt
classandobjectunit2-150824133722-lva1-app6891.pptmanomkpsg
 
Object Oriented Principles
Object Oriented PrinciplesObject Oriented Principles
Object Oriented PrinciplesSujit Majety
 
UNIT-2.pptx CS3391 Inheritance , types, packages and Interfaces
UNIT-2.pptx CS3391 Inheritance , types, packages and InterfacesUNIT-2.pptx CS3391 Inheritance , types, packages and Interfaces
UNIT-2.pptx CS3391 Inheritance , types, packages and InterfacesSakkaravarthiS1
 
3 functions and class
3   functions and class3   functions and class
3 functions and classtrixiacruz
 
Java As an OOP Language,Exception Handling & Applets
Java As an OOP Language,Exception Handling & AppletsJava As an OOP Language,Exception Handling & Applets
Java As an OOP Language,Exception Handling & AppletsHelen SagayaRaj
 

Similar a Classes,object and methods java (20)

Ch-2ppt.pptx
Ch-2ppt.pptxCh-2ppt.pptx
Ch-2ppt.pptx
 
Classes & objects new
Classes & objects newClasses & objects new
Classes & objects new
 
Classes,object and methods jav
Classes,object and methods javClasses,object and methods jav
Classes,object and methods jav
 
packages and interfaces
packages and interfacespackages and interfaces
packages and interfaces
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
Wrapper classes
Wrapper classesWrapper classes
Wrapper classes
 
Classes, objects in JAVA
Classes, objects in JAVAClasses, objects in JAVA
Classes, objects in JAVA
 
Java defining classes
Java defining classes Java defining classes
Java defining classes
 
Delphi qa
Delphi qaDelphi qa
Delphi qa
 
Hemajava
HemajavaHemajava
Hemajava
 
4 Classes & Objects
4 Classes & Objects4 Classes & Objects
4 Classes & Objects
 
Reflection
ReflectionReflection
Reflection
 
Ap Power Point Chpt4
Ap Power Point Chpt4Ap Power Point Chpt4
Ap Power Point Chpt4
 
classandobjectunit2-150824133722-lva1-app6891.ppt
classandobjectunit2-150824133722-lva1-app6891.pptclassandobjectunit2-150824133722-lva1-app6891.ppt
classandobjectunit2-150824133722-lva1-app6891.ppt
 
Object Oriented Principles
Object Oriented PrinciplesObject Oriented Principles
Object Oriented Principles
 
UNIT-2.pptx CS3391 Inheritance , types, packages and Interfaces
UNIT-2.pptx CS3391 Inheritance , types, packages and InterfacesUNIT-2.pptx CS3391 Inheritance , types, packages and Interfaces
UNIT-2.pptx CS3391 Inheritance , types, packages and Interfaces
 
3 functions and class
3   functions and class3   functions and class
3 functions and class
 
C# interview
C# interviewC# interview
C# interview
 
Java As an OOP Language,Exception Handling & Applets
Java As an OOP Language,Exception Handling & AppletsJava As an OOP Language,Exception Handling & Applets
Java As an OOP Language,Exception Handling & Applets
 
Chapter 7 java
Chapter 7 javaChapter 7 java
Chapter 7 java
 

Más de Padma Kannan

Más de Padma Kannan (13)

B tree
B treeB tree
B tree
 
Operators in C++
Operators in C++Operators in C++
Operators in C++
 
Java packags
Java packagsJava packags
Java packags
 
Java and c++
Java and c++Java and c++
Java and c++
 
Inheritance
InheritanceInheritance
Inheritance
 
Functions in c++
Functions in c++Functions in c++
Functions in c++
 
Functions in c++,
Functions in c++,Functions in c++,
Functions in c++,
 
Functions of dbms
Functions  of dbmsFunctions  of dbms
Functions of dbms
 
Basic concept of oops
Basic concept of oopsBasic concept of oops
Basic concept of oops
 
LEARNING BASES OF ACTICITY
LEARNING BASES OF ACTICITYLEARNING BASES OF ACTICITY
LEARNING BASES OF ACTICITY
 
Social networking risks
Social networking risksSocial networking risks
Social networking risks
 
Inheritance
InheritanceInheritance
Inheritance
 
Excel2002
Excel2002Excel2002
Excel2002
 

Último

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...apidays
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 

Último (20)

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 

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
  • 2.
  • 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.