SlideShare a Scribd company logo
1 of 13
Download to read offline
Prepared Using




    Nested Type
    For Semester – III [MCA]
    August
    2012



    Prepared by
    Prof. Ashish Bhatia
    ast.bhatia@gmail.com
    ashish@asbspace.in
    www.asbspace.in



1                                           Prepared By: Prof. Ashish Bhatia
Note
    ●   This ppt is for teaching purpose only.
    ●   The ppt may contain some material from
        books/api documentation/internet.
    ●   No intention of breaking any rights or what so
        ever.




2                                         Prepared By: Prof. Ashish Bhatia
Nested Classes
    ●   The class define inside another class are
        known as Nested Class.
    ●   Top Level Nested Class
        ●   Inner class is static
    ●   Inner Class
    ●   Local Class
    ●   Anonymous Class


3                                         Prepared By: Prof. Ashish Bhatia
Why we need nested class?
    ●   Logical Grouping of class
        ●   Helper classes
    ●   Increase encapuslation
    ●




4                                   Prepared By: Prof. Ashish Bhatia
Top Level Nested Class
    ●   Static member class is also known as top level
        nested class.
    ●   Member class and enclosing class shares trust
        replationship in that they can access each
        other memebers, including private members.




5                                        Prepared By: Prof. Ashish Bhatia
6   Prepared By: Prof. Ashish Bhatia
Inner Classes
    ●   Non-static member classes.
    ●   Relationship :
        ●   We cannot have an instance of innerclass without
            having instance of the outer class.
    ●   Used to represent one to many relationship.
    ●   Eg : Account Class [Outer]and Transaction
        class[Inner]
        ●   We cannot have transaction without Account
    ●   Inner class cannot have static members.
7                                             Prepared By: Prof. Ashish Bhatia
8   Prepared By: Prof. Ashish Bhatia
Local Class
    ●   Class inside a method, constructor or intializer
        block.
    ●   This class donot have access specifier and
        cannot be dcelared static / non-static.




9                                         Prepared By: Prof. Ashish Bhatia
10   Prepared By: Prof. Ashish Bhatia
Anonymous Class
 ●   Do not have name.
 ●   Defined and created at same place.
 ●   Become part of expression.
 ●   Single inheritance type either extend or
     implement
 ●   Always non-abstract.


11                                    Prepared By: Prof. Ashish Bhatia
enum Type
 ●   Java 5 onwards.
 ●   Cannot have super class but can implement
     interface.
 ●   Number of instances are fixed.
 ●   ; required after declaration.
 ●   Sub class of Enum
 ●   Instances have name and ordinal value.
12                                    Prepared By: Prof. Ashish Bhatia
enum Type



             ●
               Each instance are static and final.
             ●
               Ordinal Value starts from 0
             ●
               To access Month.January
             ●
               Enum type are comparable [ ordinal]
             ●
               Values and Valuesof
             ●
               public static Month[] values()
             ●
               public static Month valueOf(String n)




13                            Prepared By: Prof. Ashish Bhatia

More Related Content

More from ashishspace

I/O In Java Part 2
I/O In Java Part 2I/O In Java Part 2
I/O In Java Part 2ashishspace
 
I/O in java Part 1
I/O in java Part 1I/O in java Part 1
I/O in java Part 1ashishspace
 
Remote Method Invocation
Remote Method InvocationRemote Method Invocation
Remote Method Invocationashishspace
 
Understanding Date Handling and Collection Framework
Understanding Date Handling and Collection FrameworkUnderstanding Date Handling and Collection Framework
Understanding Date Handling and Collection Frameworkashishspace
 
HTTP Basic and Servlet Basic
HTTP Basic and Servlet BasicHTTP Basic and Servlet Basic
HTTP Basic and Servlet Basicashishspace
 
Java packages and access specifiers
Java packages and access specifiersJava packages and access specifiers
Java packages and access specifiersashishspace
 
Data types and operators and statements
Data types and operators and statementsData types and operators and statements
Data types and operators and statementsashishspace
 

More from ashishspace (7)

I/O In Java Part 2
I/O In Java Part 2I/O In Java Part 2
I/O In Java Part 2
 
I/O in java Part 1
I/O in java Part 1I/O in java Part 1
I/O in java Part 1
 
Remote Method Invocation
Remote Method InvocationRemote Method Invocation
Remote Method Invocation
 
Understanding Date Handling and Collection Framework
Understanding Date Handling and Collection FrameworkUnderstanding Date Handling and Collection Framework
Understanding Date Handling and Collection Framework
 
HTTP Basic and Servlet Basic
HTTP Basic and Servlet BasicHTTP Basic and Servlet Basic
HTTP Basic and Servlet Basic
 
Java packages and access specifiers
Java packages and access specifiersJava packages and access specifiers
Java packages and access specifiers
 
Data types and operators and statements
Data types and operators and statementsData types and operators and statements
Data types and operators and statements
 

Recently uploaded

Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptshraddhaparab530
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Food processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture honsFood processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture honsManeerUddin
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 

Recently uploaded (20)

Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.ppt
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
Food processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture honsFood processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture hons
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 

Nested Class and Enum PPT for MCA Semester III

  • 1. Prepared Using Nested Type For Semester – III [MCA] August 2012 Prepared by Prof. Ashish Bhatia ast.bhatia@gmail.com ashish@asbspace.in www.asbspace.in 1 Prepared By: Prof. Ashish Bhatia
  • 2. Note ● This ppt is for teaching purpose only. ● The ppt may contain some material from books/api documentation/internet. ● No intention of breaking any rights or what so ever. 2 Prepared By: Prof. Ashish Bhatia
  • 3. Nested Classes ● The class define inside another class are known as Nested Class. ● Top Level Nested Class ● Inner class is static ● Inner Class ● Local Class ● Anonymous Class 3 Prepared By: Prof. Ashish Bhatia
  • 4. Why we need nested class? ● Logical Grouping of class ● Helper classes ● Increase encapuslation ● 4 Prepared By: Prof. Ashish Bhatia
  • 5. Top Level Nested Class ● Static member class is also known as top level nested class. ● Member class and enclosing class shares trust replationship in that they can access each other memebers, including private members. 5 Prepared By: Prof. Ashish Bhatia
  • 6. 6 Prepared By: Prof. Ashish Bhatia
  • 7. Inner Classes ● Non-static member classes. ● Relationship : ● We cannot have an instance of innerclass without having instance of the outer class. ● Used to represent one to many relationship. ● Eg : Account Class [Outer]and Transaction class[Inner] ● We cannot have transaction without Account ● Inner class cannot have static members. 7 Prepared By: Prof. Ashish Bhatia
  • 8. 8 Prepared By: Prof. Ashish Bhatia
  • 9. Local Class ● Class inside a method, constructor or intializer block. ● This class donot have access specifier and cannot be dcelared static / non-static. 9 Prepared By: Prof. Ashish Bhatia
  • 10. 10 Prepared By: Prof. Ashish Bhatia
  • 11. Anonymous Class ● Do not have name. ● Defined and created at same place. ● Become part of expression. ● Single inheritance type either extend or implement ● Always non-abstract. 11 Prepared By: Prof. Ashish Bhatia
  • 12. enum Type ● Java 5 onwards. ● Cannot have super class but can implement interface. ● Number of instances are fixed. ● ; required after declaration. ● Sub class of Enum ● Instances have name and ordinal value. 12 Prepared By: Prof. Ashish Bhatia
  • 13. enum Type ● Each instance are static and final. ● Ordinal Value starts from 0 ● To access Month.January ● Enum type are comparable [ ordinal] ● Values and Valuesof ● public static Month[] values() ● public static Month valueOf(String n) 13 Prepared By: Prof. Ashish Bhatia