GoConqr has a new look! Let us know what you think.

Flashcards

Inner Class

BLU BLU German 6 cards

Cards in this deck (6)

  1. 1Nested (static) inner Class- A static class nested with in another class
    - Does not have access to instance members of the outer class.
    - Can be accessed using the outer class name
  2. 2Non-Static inner Class- A regular class inside another class
    - Has access to all the members (including private) of the outer class
    - Must be instantiated using an object of the outer class.
  3. 3Local Inner Class- A class defined inside a method, block, or constructor
    - Visible only within the block or method it is defined in.
    - Cannot access local variables unless they are final or effectively final.
  4. 4Anonymous Inner Class- A class without a name that is used to instantiate an object on the fly
    - Used when you need a short implementation of a class or interface
  5. 5Wann werden innere Klassen verwendet und welche 4 verschiedenen inneren Klassen gibt es?Innere Klassen (Inner Classes) in Java
    ✅ Wann werden sie verwendet?
    Wenn eine Klasse nur innerhalb einer anderen Klasse benötigt wird
    Um auf private Mitglieder der äußeren Klasse zuzugreifen
    Zur besseren Strukturierung und Kapselung
    Zum Verstecken von Implementierungsdetails
    ✅ Arten:
    Nicht-statische innere Klasse: Hat Zugriff auf Instanzvariablen der äußeren Klasse
    Statische innere Klasse: Kann nur auf statische Elemente zugreifen
    Lokale innere Klasse: Wird innerhalb einer Methode definiert
    Anonyme innere Klasse: Direkte Instanziierung, oft für Schnittstellenimplementierung
  6. 6—

Information

Description
Flashcards on Inner Class, created by BLU BLU on 26/03/2025.
Created by
BLU BLU
Views
1
Rating

Feedback

What is it about?

What do you think of the new look?

How do you like it?