Java Interface
Why do we need a Java Interface?
to overcome the problem of multiple inheritances
List interface
Vector
xxx
synchronized
xxx
What’s wrong with the code below?
List < String > fields = new List < String >;
‘List’ is abstract; cannot be instantiated.
Explain codes:
ISaveable werewolf = new Monster (“Werewolf”, 20, 40);
System.out.println (((Monster) werewolf).getStrenth());
xxx
How to create an instance of an inner class?
OuterClass.InnerClass reference = outerObject.new InnerClassConstructor()
Gearbox mcLaren = new Gearbox(6); Gearbox.Gear first = mcLaren.new Gear(1, 12.3);
Inner class
it refers to the class that is declared within class or interface
Types of Inner Classes
Nested/Normal/Regular Inner Class