A. Factory B. AbstractFactory C. Singleton D. Builder
举一反三
- 下面的代码实现了设计模式中的什么模式public class A {priv...return instance;}}
- Which of the following is the order of applying object-oriented concept in programming A: instance creating — class defining — use attributes or methods through the instance B: class defining — instance creating — use attributes or methods through the instance C: instance creating — use attributes or methods through the instance — class defining D: class defining — use attributes or methods through the instance —instance creating
- Which of the following is false? ( ) A: A static method must be used to access private static instance variables. B: A static method can be accessed even when no objects of its class have been instantiated. C: A static method has no this reference. D: A static method can call instance methods directly.
- 定义类的关键字是 ( ) A: Class B: class C: Instance D: instance
- An instance member() A: is also called a static member B: is always a variable C: is never a method D: belongs to a single instance, not to the class as a whole E: always represents an operatio
内容
- 0
An instance member() A: is also called a static member B: is always a variable C: is never a method D: belongs to a single instance, not to the class as a whole E: always represents an operation
- 1
如下代码:public class X {public X aMethod() { return this;}}public class Y extends X { }哪两个方法能加到Y类的定义中? A: public void aMethod(String s) {} B: public void aMethod() {} C: private Y aMethod() { return null; } D: public X aMethod() { return new Y(); } E: private void aMethod() {}
- 2
中国大学MOOC: There are following business statements for an information system:①A customer submit 0 or more orders;②An order can only be submitted by one customer. There are two classes in the system “Customer” and “Order”. For each instance of Order Class, there are ____ instance(s) of Customer Class; while for each instance of Customer Class, there are ____ instance(s) of Order Class.
- 3
public class enclosingone ( public class insideone{} ) public class inertest( public static void main (stringargs)( enclosingone eo= new enclosingone (); //insert code here ) ) Which statement at line 7 constructs an instance of the inner class?() A: InsideOnew ei= eo.new InsideOn(); B: Eo.InsideOne ei = eo.new InsideOne(); C: InsideOne ei = EnclosingOne.new InsideOne(); D: EnclosingOne.InsideOne ei = eo.new InsideOne();
- 4
中国大学MOOC: 如果有以下程序片段public class Some{ private Some some; private Some(){} public static Some create(){ if(some==null) some = new Some(); return some; }}以下描述正确的是