ENUMERATIONS AND NESTED CLASSES

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/28

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 1:23 PM on 3/29/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

29 Terms

1
New cards
Enumeration (enum)
A data type that contains a fixed set of constants
2
New cards
Enum constants
The specific values defined inside an enum that are the only allowed values
3
New cards
Type-safe
A feature where only valid values are allowed preventing invalid data at compile time
4
New cards
Enum declaration
The process of defining an enum using the enum keyword followed by constants
5
New cards
Enum variable
A variable declared using an enum type that can only store its defined constants
6
New cards
Compile-time error
An error detected during compilation when invalid enum values are used
7
New cards
Runtime error
An error that occurs during program execution
8
New cards
toString()
Returns the name of the enum constant as a string
9
New cards
ordinal()
Returns the position of the enum constant starting from 0
10
New cards
equals()
Compares two enum constants and returns true if they are the same
11
New cards
compareTo()
Compares the order of enum constants and returns a positive negative or zero value
12
New cards
valueOf()
Converts a string into its corresponding enum constant
13
New cards
values()
Returns an array containing all enum constants
14
New cards
Enhanced for loop
A loop used to iterate through all enum values using values()
15
New cards
Switch with enum
Using enum constants in a switch statement for cleaner and safer conditional logic
16
New cards
Comparison operators with enums
Using operators like == instead of compareTo() for direct comparison
17
New cards
Nested class
A class defined inside another class
18
New cards
Top-level class
The outer class that contains the nested class
19
New cards
Inner class
A non-static nested class that requires an instance of the outer class
20
New cards
Static member class
A nested class that can access only static members of the outer class
21
New cards
Local class
A class defined inside a method
22
New cards
Anonymous class
A class without a name used for one-time implementations
23
New cards
Private inner class
An inner class that is only accessible within its outer class
24
New cards
Encapsulation (nested classes)
Keeping related data and behavior together while hiding implementation details
25
New cards
Outer class access
The outer class can access members of its inner class
26
New cards
Inner class access
The inner class can access all members even private of the outer class
27
New cards
Code organization
Structuring code to make it easier to understand and maintain using nested classes
28
New cards
Tightly coupled classes
Classes that are closely related and often used together making nesting useful
29
New cards
Reusability limitation (inner class)
Inner classes are typically not reusable outside their outer class