1/15
Flashcards to review key concepts related to type casting, polymorphism, and inner classes in Java.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Type Casting
The process of converting a variable from one data type to another.
Two Main data types
Primitive data types and User-defined data types
Widening Type Casting
Implicit type casting, done by the compiler, which widens or upcasts a smaller type to a larger type (e.g., int to double).
Narrowing Type Casting
Explicit type casting, done manually by the user, which narrows or downcasts a larger type to a smaller type (e.g., double to int).
Data Loss
May lead to data loss, particularly in narrowing type casting.
Class Type Casting
Requires an 'Is-a' relationship between classes.
Static Binding (Early Binding)
Performed at compilation time; involves static, private, and final methods; uses overloaded methods.
Dynamic Binding (Late Binding)
Performed at execution time; involves overridden methods.
Class Type Upcasting
A parent class object referring to its child class object.
Class Type Downcasting
A child class object referring to its parent class object, which may require explicit downcasting.
Inner Classes
Classes defined inside another class, used for grouping related classes, improving code readability and maintainability, and supporting encapsulation.
Regular Inner Class
Cannot be directly accessed from outside the outer class without creating an instance of the outer class first.
Private Inner Class
Cannot be accessed from outside the class
Static Inner Classes
Can be accessed without creating an object of the outer class.
M.I.C.E.
Messages, Inheritance, Class, Encapsulation
R.P.I.G.S.
Relationships, Polymorphism, Information Hiding, Generics, State Retention