CMSC 132 Exam 1 Review
Abstraction - answer Separates the interface from the algorithms
Encapsulation - answer Hides the algorithms and only provides the interface
Abstract method - answer All methods in an interface are abstract implicitly, unless
"default" keyword
In a non-interface, the class must be declared abstract
"Is a" relationship - answer Interfaces
Enhanced for loop – answer for (int index : some Array)
Sysout (index);
Will print out each item in some Array
Autoboxing & Unboxing - answerJava will automatically convert from primitive data type
to its matching Object (int + Integer, double + Double, etc.)
Annotations - answerInforms compiler of goal, if code does not achieve goal, will not
compile
Overriding vs. Overloading - answerOverriding - same name and same parameters
Overloading - same name but different parameters
Early (static) binding - answerPerson p= new Faculty ("Carol");
Sysout(p);
calls Person's toString
NOT used in Java
Late (dynamic) binding - answerPerson p= new Faculty ("Carol");
Sysout(p);
calls Faculty's toString
used in Java
Upcasting - answerCasting a reference to a base class, done automatically and always
safe
Abstraction - answer Separates the interface from the algorithms
Encapsulation - answer Hides the algorithms and only provides the interface
Abstract method - answer All methods in an interface are abstract implicitly, unless
"default" keyword
In a non-interface, the class must be declared abstract
"Is a" relationship - answer Interfaces
Enhanced for loop – answer for (int index : some Array)
Sysout (index);
Will print out each item in some Array
Autoboxing & Unboxing - answerJava will automatically convert from primitive data type
to its matching Object (int + Integer, double + Double, etc.)
Annotations - answerInforms compiler of goal, if code does not achieve goal, will not
compile
Overriding vs. Overloading - answerOverriding - same name and same parameters
Overloading - same name but different parameters
Early (static) binding - answerPerson p= new Faculty ("Carol");
Sysout(p);
calls Person's toString
NOT used in Java
Late (dynamic) binding - answerPerson p= new Faculty ("Carol");
Sysout(p);
calls Faculty's toString
used in Java
Upcasting - answerCasting a reference to a base class, done automatically and always
safe