Exam Preparation Angela Flashcards
Proper names of Classes State and Behaviour
Fields, and Methods
Creating an object from a class
Type name = new Constructor()
During inheritance what does the subclass inherit from the superclass
Non private Fields and Methods
Name 3 main errors and what they are
Syntax (compile time error), Runtime (java error thrown), and Logical (programmer error)
What are the two steps of Static typing
Declaration (Car c), Initalization (= new Car)
What does marking something as final mean
No changes can be made after compilation
What’s special about Final lists
The internals can be changed (add, remove, etc) however a new list can not be made from a list declared final
What is the format for the Ternary operator
Variable x = (boolean expression) ? resultIfTrue : resultIfFalse
Static Method use
result = math.ceil(parameters)
Local Method use
resultVar = name(parameters)
Object methods use
obj.name(parameters)
Requirements to overload a Method or Constructor
Type, order, and number of parameters
T/F a(obj) == b.clone(obj)
True, objects yes
T/F a[] {…} == b.clone[] {…}
False, values like in no
Public visibility
All places can access public
Private visibility
Only the class can access public fields and methods
Protected
Visible in everything but the outside world (not descendants)
What do subclasses inherit
Non private methods and fields
What is called implicitly when when extending a superclass constructor is a subclass
super(superclass values)
How are polymorphism and compilers related
The compiler won’t check the type of a method call until runtime
What are three features of Abstract classes
Classes extend then, they can not be instantiated, they are allowed to have instance variables
What are Anonymous classes and what is their general formatting
Unnamed implicit classes
public void name() { AnonName n = new AnonName() { String name = "A string"; public void anonMethod() { S.o.pln(name); } }; n.greet(); }
Name five common exceptions
NullPointer ArrayIndexOutOfBounds ClassCast Interrupted IO