SlideShare a Scribd company logo
1 of 14
Introdraction of this keyword
• “ this “keyword is the refer to the
current object.
• This keyword is used to the pointout the
current object.
This keyword
 The this keyword is refers to the current class
object.
 The this keyword is use the point out the
current class object.
 Java objects include a data member named
a THIS , which is actually a reference to the
current object.
 The THIS keyword is useful if you need to
refer to the current object.
Simple example of This
keyword
class student
{
int r_no;
String name;
student (int r,String n)
{
this.r_no = r ;
this.name = n ;
System.out.println (r_no:+name) ;
}
public static void main (String args [] )
{
student s1 = new student ( 1 ,” Kinjal ”);
Student s2 = new student ( 2 ,” Veena ”);
Student s3 = new student ( 6 ,” dhariya ”);
}
 Now here by using this keyword “THIS” like
this.r_no we mean that variable r_no of the
invoking object.
student s1 = new student ( 1 ,” Kinjal ”);
student ( int r , String n )
{
this . r_no = r ; //means s1.r_no
this . name = n ; // means s1.name
System . Out . println (r_no:+name) ;
}
Output:
1 : Kinjal
2 : veena
6 : dhariya
Final Keyword
final keyword
 Java’s FINAL keyword has slightly different
meanings depending on the context,but in
general it say
“ This cannot be changed” or ”This is final”
 Use of “final” in java is synonymous to use of
“Const” in c++.
 The following section discuss the three places
where final can be used for:
Data
method
classes
final Data
 Java provides you way to fix the value of any
variable by using the “final” keyword when
you declare it..
For example:
final int a = 100;
final int b=4;
 The final keyword specifies that the value of a
variable is final and must not be change.
 This makes it easy to see which variables are
defined as constant value.
final method and class
 The final keyword use for more then one
purpose in java programing.
 It can be userd with class and member.
 When the final keyword used with a class,
that prevents the class from main
inherintance,you cannot inherit class
Simple program of using the
final keyword
class abc
{
final void show ()
{
system . out .println (“Hi”) ;
}
}
class abc1 extends abc
{
public void show ();
{ Error
system . out . Println (“ Hello”) ; Display
}
}
class test
{
public static void main (String args [ ] )
{
abc1 .a1 = new abc1 () ;
a1 . show () ;
}
}
Thank you

More Related Content

What's hot (20)

Core java complete notes - Contact at +91-814-614-5674
Core java complete notes - Contact at +91-814-614-5674Core java complete notes - Contact at +91-814-614-5674
Core java complete notes - Contact at +91-814-614-5674
 
Super and final in java
Super and final in javaSuper and final in java
Super and final in java
 
Java multi threading
Java multi threadingJava multi threading
Java multi threading
 
Generics in java
Generics in javaGenerics in java
Generics in java
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 
Java basics and java variables
Java basics and java variablesJava basics and java variables
Java basics and java variables
 
Abstract class in java
Abstract class in javaAbstract class in java
Abstract class in java
 
Polymorphism in c++(ppt)
Polymorphism in c++(ppt)Polymorphism in c++(ppt)
Polymorphism in c++(ppt)
 
Control statements in java
Control statements in javaControl statements in java
Control statements in java
 
CLASS OBJECT AND INHERITANCE IN PYTHON
CLASS OBJECT AND INHERITANCE IN PYTHONCLASS OBJECT AND INHERITANCE IN PYTHON
CLASS OBJECT AND INHERITANCE IN PYTHON
 
Constructor ppt
Constructor pptConstructor ppt
Constructor ppt
 
Scope of variables
Scope of variablesScope of variables
Scope of variables
 
Generics
GenericsGenerics
Generics
 
Inheritance in JAVA PPT
Inheritance  in JAVA PPTInheritance  in JAVA PPT
Inheritance in JAVA PPT
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 
Super keyword in java
Super keyword in javaSuper keyword in java
Super keyword in java
 
C# classes objects
C#  classes objectsC#  classes objects
C# classes objects
 
Threads in JAVA
Threads in JAVAThreads in JAVA
Threads in JAVA
 
Enumeration in Java Explained | Java Tutorial | Edureka
Enumeration in Java Explained | Java Tutorial | EdurekaEnumeration in Java Explained | Java Tutorial | Edureka
Enumeration in Java Explained | Java Tutorial | Edureka
 
Java Exception handling
Java Exception handlingJava Exception handling
Java Exception handling
 

Viewers also liked

Viewers also liked (12)

Final java presentation
Final java presentationFinal java presentation
Final java presentation
 
Java Methods - An Introduction to Software Development
Java Methods - An Introduction to Software DevelopmentJava Methods - An Introduction to Software Development
Java Methods - An Introduction to Software Development
 
Keywords of java
Keywords of javaKeywords of java
Keywords of java
 
06 java methods
06 java methods06 java methods
06 java methods
 
Final keyword
Final keywordFinal keyword
Final keyword
 
Access modifiers in java
Access modifiers in javaAccess modifiers in java
Access modifiers in java
 
Methods in Java
Methods in JavaMethods in Java
Methods in Java
 
Chapter 2 Java Methods
Chapter 2 Java MethodsChapter 2 Java Methods
Chapter 2 Java Methods
 
Access modifiers in java
Access modifiers in javaAccess modifiers in java
Access modifiers in java
 
Java Methods
Java MethodsJava Methods
Java Methods
 
Java access modifiers
Java access modifiersJava access modifiers
Java access modifiers
 
Core java notes with examples
Core java notes with examplesCore java notes with examples
Core java notes with examples
 

Similar to This keyword and final keyword

Java tutorial for Beginners and Entry Level
Java tutorial for Beginners and Entry LevelJava tutorial for Beginners and Entry Level
Java tutorial for Beginners and Entry LevelRamrao Desai
 
C Sharp: Basic to Intermediate Part 01
C Sharp: Basic to Intermediate Part 01C Sharp: Basic to Intermediate Part 01
C Sharp: Basic to Intermediate Part 01Zafor Iqbal
 
Introduction to java programming
Introduction to java programmingIntroduction to java programming
Introduction to java programmingshinyduela
 
Java findamentals2
Java findamentals2Java findamentals2
Java findamentals2Todor Kolev
 
Java findamentals2
Java findamentals2Java findamentals2
Java findamentals2Todor Kolev
 
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
 
packages and interfaces
packages and interfacespackages and interfaces
packages and interfacesmadhavi patil
 
Basics of java 2
Basics of java 2Basics of java 2
Basics of java 2Raghu nath
 
Oop features java presentationshow
Oop features java presentationshowOop features java presentationshow
Oop features java presentationshowilias ahmed
 
Lecture - 3 Variables-data type_operators_oops concept
Lecture - 3 Variables-data type_operators_oops conceptLecture - 3 Variables-data type_operators_oops concept
Lecture - 3 Variables-data type_operators_oops conceptmanish kumar
 

Similar to This keyword and final keyword (20)

constructer.pptx
constructer.pptxconstructer.pptx
constructer.pptx
 
Java tutorial for Beginners and Entry Level
Java tutorial for Beginners and Entry LevelJava tutorial for Beginners and Entry Level
Java tutorial for Beginners and Entry Level
 
Java keywords
Java keywordsJava keywords
Java keywords
 
Keywords and classes
Keywords and classesKeywords and classes
Keywords and classes
 
C Sharp: Basic to Intermediate Part 01
C Sharp: Basic to Intermediate Part 01C Sharp: Basic to Intermediate Part 01
C Sharp: Basic to Intermediate Part 01
 
Only oop
Only oopOnly oop
Only oop
 
Introduction to java programming
Introduction to java programmingIntroduction to java programming
Introduction to java programming
 
Chap11
Chap11Chap11
Chap11
 
Ch-2ppt.pptx
Ch-2ppt.pptxCh-2ppt.pptx
Ch-2ppt.pptx
 
Java findamentals2
Java findamentals2Java findamentals2
Java findamentals2
 
Java findamentals2
Java findamentals2Java findamentals2
Java findamentals2
 
Static keyword.pptx
Static keyword.pptxStatic keyword.pptx
Static keyword.pptx
 
Python - object oriented
Python - object orientedPython - object oriented
Python - object oriented
 
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
 
packages and interfaces
packages and interfacespackages and interfaces
packages and interfaces
 
Object oriented concepts
Object oriented conceptsObject oriented concepts
Object oriented concepts
 
Basics of java 2
Basics of java 2Basics of java 2
Basics of java 2
 
Java session4
Java session4Java session4
Java session4
 
Oop features java presentationshow
Oop features java presentationshowOop features java presentationshow
Oop features java presentationshow
 
Lecture - 3 Variables-data type_operators_oops concept
Lecture - 3 Variables-data type_operators_oops conceptLecture - 3 Variables-data type_operators_oops concept
Lecture - 3 Variables-data type_operators_oops concept
 

Recently uploaded

Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).pptssuser5c9d4b1
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...Call Girls in Nagpur High Profile
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 

Recently uploaded (20)

Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 

This keyword and final keyword

  • 1.
  • 2. Introdraction of this keyword • “ this “keyword is the refer to the current object. • This keyword is used to the pointout the current object.
  • 3. This keyword  The this keyword is refers to the current class object.  The this keyword is use the point out the current class object.  Java objects include a data member named a THIS , which is actually a reference to the current object.  The THIS keyword is useful if you need to refer to the current object.
  • 4. Simple example of This keyword class student { int r_no; String name; student (int r,String n) { this.r_no = r ; this.name = n ; System.out.println (r_no:+name) ; }
  • 5. public static void main (String args [] ) { student s1 = new student ( 1 ,” Kinjal ”); Student s2 = new student ( 2 ,” Veena ”); Student s3 = new student ( 6 ,” dhariya ”); }
  • 6.  Now here by using this keyword “THIS” like this.r_no we mean that variable r_no of the invoking object. student s1 = new student ( 1 ,” Kinjal ”); student ( int r , String n ) { this . r_no = r ; //means s1.r_no this . name = n ; // means s1.name System . Out . println (r_no:+name) ; }
  • 7. Output: 1 : Kinjal 2 : veena 6 : dhariya
  • 9. final keyword  Java’s FINAL keyword has slightly different meanings depending on the context,but in general it say “ This cannot be changed” or ”This is final”  Use of “final” in java is synonymous to use of “Const” in c++.  The following section discuss the three places where final can be used for: Data method classes
  • 10. final Data  Java provides you way to fix the value of any variable by using the “final” keyword when you declare it.. For example: final int a = 100; final int b=4;  The final keyword specifies that the value of a variable is final and must not be change.  This makes it easy to see which variables are defined as constant value.
  • 11. final method and class  The final keyword use for more then one purpose in java programing.  It can be userd with class and member.  When the final keyword used with a class, that prevents the class from main inherintance,you cannot inherit class
  • 12. Simple program of using the final keyword class abc { final void show () { system . out .println (“Hi”) ; } }
  • 13. class abc1 extends abc { public void show (); { Error system . out . Println (“ Hello”) ; Display } } class test { public static void main (String args [ ] ) { abc1 .a1 = new abc1 () ; a1 . show () ; } }