Self-study questions for Sun Certified Java Programmer (SCJP) (310-055). God speed!
Interface Base2 implements Base { }
Abstract class Class2 extends Base { public boolean ml() { return true; } }
Abstract class Class2 implements Base { }
# abstract class Class2. implements Base { public boolean m1() { return (true); } }
Class Class2 implements Base { boolean m1( ) { return false; } byte m2(short s) { return 42; } }
Public abstract class Canine { public Bark speak(); }
Public abstract class Canine { public Bark speak() { } }
Public class Canine { public abstract Bark speak(); }
Public class Canine abstract { public abstract Bark speak(); }
"X extends Y" is correct if and only if X is a class and Y is an interface.
"X extends Y" is correct if and only if X is an interface and Y is a class.
"X extends Y" is correct if X and Y are either both classes or both interfaces.
"X extends Y" is correct for all combinations of X and Y being classes and/or interfaces.
Int $x;
Int 123;
Int _123;
Int #dim;
Int central_sales_region_Summer_2005_gross_sales;
AddSize
GetCust
DeleteRep
IsColorado
PutDimensions
Static void doStuff(int... doArgs) { }
Static void doStuff (int [] doArgs) { }
Static void doStuff(int doArgs...) { }
Static void doStuff(int... doArgs, int y) { }
Static void doStuff(int x, int... doArgs) { }
Has-a relationships always rely on inheritance.
Has-a relationships always rely on instance variables.
Has-a relationships always require at least two class types
Has-a relationships always rely on polymorphism.
Has-a relationships are always tightly coupled.
Flip a Clidlet
Flip a Clidde
Flip a Clidder Flip a Clidlet
# Flip a Clidlet Flip a Clidder
Compilation fails.
Public abstract class Frob implements Frobnicate { public abstract void twiddle(String s){} }
Public abstract class Frob implements Frobnicate { }
Public class Frob extends Frobnicate { public void twiddle(Integer i) { } }
Public class Frob implements Frobnicate { public void twiddle(Integer i) { } }
Public class Frob implements Frobnicate { public void twiddle(String i) { } public void twiddle(Integer s) { } }
BD
DB
BDC
DBC
Compilation fails.
The attributes of the class are all private.
The class refers to a small number of other objects.
The object contains only a small number of variables.
The reference variable is declared for an interface type, not a class. The interface provides a small number of methods.
It is unlikely that changes made to one class will require any changes in another.
Clidlet
Clidder
Clidder Clidlet
Clidlet Clidder
Compilation fails.
Wait!
Here's an interesting quiz for you.