An encapsulated, public class promotes re-use.
Classes that share the same interface are always tightly encapsulated.
An encapsulated class allows subclasses to overload methods, but does NOT allow overriding methods.
An encapsulated class allows a programmer to change an implementation without affecting outside code.
第1题:
In which two cases does the compiler supply a default constructor for class A?()
第2题:
Which two allow the class Thing to be instantiated using new Thing()?
第3题:
class One { public One foo() { return this; } } class Two extends One { public One foo() { return this; } } class Three extends Two { // insert method here } Which two methods, inserted individually, correctly complete the Three class?()
第4题:
Which statements about inheritance are true?()
第5题:
Given a class whose instances, when found in a collection of objects, are sorted by using the compareTo() method, which two statements are true?()
第6题:
public interface Person { } public class Employee extends Person { }
public interface Shape { } public class Employee extends Shape { }
public interface Color { } public class Employee extends Color { }
public class Species { } public class Animal (private Species species;)
interface Component { } Class Container implements Component ( Private Component[ ] children; )
第7题:
An inner class may be declared as static.
An anonymous inner class can be declared as public.
An anonymous inner class can be declared as private.
An anonymous inner class can extend an abstract class.
An anonymous inner class can be declared as protected.
第8题:
public void aMethod() {}
private void aMethod() {}
public void aMethod(String s) {}
private Y aMethod() { return null; }
public X aMethod() { return new Y(); }
第9题:
class A{}
class A { public A(){} }
class A { public A(int x){} }
class Z {} class A extends Z { void A(){} }
第10题:
Compilation of both classes will fail.
Compilation of both classes will succeed.
Compilation of class a will fail. Compilation of class b will succeed.
Compilation of class a will fail. Compilation of class a will succeed.
第11题:
The class is fully encapsulated.
The code demonstrates polymorphism.
The ownerName variable breaks encapsulation.
The cardlD and limit variables break polymorphism.
The setCardlnformation method breaks encapsulation.
第12题:
public class Thing { }
public class Thing { public Thing() {} }
public class Thing { public Thing(void) {} }
public class Thing { public Thing(String s) {} }
public class Thing { public void Thing() {} public Thing(String s) {} }
第13题:
Which three demonstrate an “is a” relationship?()
第14题:
public class CreditCard { private String cardlD; private Integer limit; public String ownerName; public void setCardlnformation(String cardlD, String ownerName, 28. Integer limit) { this.cardlD = cardlD; this.ownerName = ownerName; this.limit = limit; } } Which is true?()
第15题:
Which the two demonstrate an “is a” relationship?()
第16题:
Which two demonstrate an “is a” relationship?()
第17题:
public class Mycircle { public double radius; public double diameter; public void setRadius(double radius) this.radius = radius; this.diameter= radius * 2; } public double getRadius() { return radius; } Which statement is true?()
第18题:
An encapsulated, public class promotes re-use.
Classes that share the same interface are always tightly encapsulated.
An encapsulated class allows subclasses to overload methods, but does NOT allow overriding methods.
An encapsulated class allows a programmer to change an implementation without affecting outside code.
第19题:
The class implements java.lang.Comparable.
The class implements java.util.Comparator.
The interface used to implement sorting allows this class to define only one sort sequence.
The interface used to implement sorting allows this class to define many different sort sequences.
第20题:
public interface Person {} Public class Employee extends Person {}
public interface Shape {} public interface Rectangle extends Shape {}
public interface Color {} public class Shape { private Color color; }
public class Species {} public class Animal { private Species species; }
interface Component {} Class Container implements Component {private Component [] children;
第21题:
public void foo() { }
public int foo() { return 3; }
public Two foo() { return this; }
public One foo() { return this; }
public Object foo() { return this; }
第22题:
public class X { } public class Y extends X { }
public interface Shape { } public interface Rectangle extends Shape{ }
public interface Color { } public class Shape { private Color color; }
public interface Species { } public class Animal { private Species species; }
public class Person { } public class Employee { public Employee(Person person) { }
interface Component { } class Container implements Component { private Component[] children; }
第23题:
An inner class may be declared as static.
An anonymous inner class can be declared as public.
An anonymous inner class can be declared as private.
An anonymous inner class can extend an abstract class.
An anonymous inner class can be declared as protected.
第24题:
In Java programming language only allows single inheritance.
In Java programming language allows a class to implement only one interface.
In Java programming language a class cannot extend a class and implement a interface together.
In Java programming language single inheritance makes code more reliable.