Part of the signature of the String class is:class String {....};Other part of signature and implementation is completed by you.

题目

Part of the signature of the String class is:

class String {

....

};

Other part of signature and implementation is completed by you.


相似考题
更多“Part of the signature of the String class is:class String {....};Other part of signature and implementation is completed by you.”相关问题
  • 第1题:

    已知类 String 的原型为

    class string

    {

    public:

    string(const char *str=null);//普通构造函数

    string(const string &other);//拷贝构造函数

    ---string(void);

    string &operate=(const string &other);//赋值函数

    private:

    char * m-data;//用于保存字符串

    };

    请编写 string 的上述4 个函数


    正确答案:
     

  • 第2题:

    类Account中字段声明正确的是?()    

    • A、class Account{  name;  amount;  }
    • B、class Account{  String name;  double amount;  }
    • C、class Account{  String name=1.0;  double amount=”Mike”;  }
    • D、class Account{  String name=”Mike”,double amount=1000.0;  }

    正确答案:B

  • 第3题:

    class Mineral {   static String shiny() { return "1"; }   }   class Granite extends Mineral {   public static void main(String [] args) {   String s = shiny() + getShiny();   s = s + super.shiny();   System.out.println(s);   }   static String getShiny() { return shiny(); }   }   结果为:()  

    • A、3
    • B、12
    • C、111
    • D、编译失败

    正确答案:D

  • 第4题:

    A programmer is designing a class to encapsulate the information about an inventory item. A JavaBeans component is needed to do this. The Inventoryltem class has private instance variables to store the item information:  10. private int itemId;  11. private String name;  12. private String description;  Which method signature follows the JavaBeans naming standards for modifying the itemld instance variable?() 

    • A、 itemID(int itemId)
    • B、 update(int itemId)
    • C、 setItemId(int itemId)
    • D、 mutateItemId(int itemId)
    • E、 updateItemID(int itemId)

    正确答案:C

  • 第5题:

    现有:  class Guy {String greet()    {return "hi";  }  }  class Cowboy extends Guy  (  String greet()    (  return "howdy  ¨;    )  )  class Surfer extends Guy  (String greet()    (return "dude! ";)) class Greetings  {  public static void main (String  []  args)    {  Guy  []  guys =  ( new Guy(), new Cowboy(), new Surfer()  );  for (Guy g:  guys) System.out.print (g.greet()};  }  }  结果为:() 

    • A、 hi howdy dude!
    • B、运行时异常被抛出。
    • C、第7行出现一个错误,编译失败。
    • D、第8行出现一个错误,编译失败。

    正确答案:A

  • 第6题:

    public class Plant {  private String name;  public Plant(String name) { this.name = name; }  public String getName() { return name; }  }  public class Tree extends Plant {  public void growFruit() { }  public void dropLeaves() { }  }  Which is true?() 

    • A、 The code will compile without changes.
    • B、 The code will compile if public Tree() { Plant(); } is added to the Tree class.
    • C、 The code will compile if public Plant() { Tree(); } is added to the Plant class.
    • D、 The code will compile if public Plant() { this(”fern”); } is added to the Plant class.
    • E、 The code will compile if public Plant() { Plant(”fern”); } is added to the Plant class.

    正确答案:D

  • 第7题:

    public class Employee{   private String name;   public Employee(String name){   this.name = name;  }   public String getName(){   return name;  }  }   public class Manager extends Employee{   public Manager(String name){   System.out.println(getName());  }  }   执行语句new Manager(“smith”)后程序的输出是哪项?() 

    • A、 smith
    • B、 null
    • C、 编译错误
    • D、 name

    正确答案:C

  • 第8题:

    If you use ALTER DISKGROUP ... ADD DISK and specify a wildcard for the discovery string, what happens to disks that are already a part of the same or another disk group?()  

    • A、 The command fails unless you specify the FORCE option.
    • B、 The command fails unless you specify the REUSE option.
    • C、 The command must be reissued with a more specific discovery string.
    • D、 The other disks, already part of the disk group,are ignored.

    正确答案:D

  • 第9题:

    单选题
    public class Plant {  private String name;  public Plant(String name) { this.name = name; }  public String getName() { return name; }  }  public class Tree extends Plant {  public void growFruit() { }  public void dropLeaves() { }  }  Which is true?()
    A

     The code will compile without changes.

    B

     The code will compile if public Tree() { Plant(); } is added to the Tree class.

    C

     The code will compile if public Plant() { Tree(); } is added to the Plant class.

    D

     The code will compile if public Plant() { this(”fern”); } is added to the Plant class.

    E

     The code will compile if public Plant() { Plant(”fern”); } is added to the Plant class.


    正确答案: C
    解析: 暂无解析

  • 第10题:

    单选题
    public class Employee{       private String name;  public Employee(String name){           this.name = name;      }  public String getName(){         return name;      } }  public class Manager extends Employee{       public Manager(String name){          System.out.println(getName());      } }  执行语句new Manager(“smith”)后程序的输出是哪项?()
    A

     smith

    B

     null

    C

     编译错误

    D

     name


    正确答案: B
    解析: 暂无解析

  • 第11题:

    单选题
    Which methods from the String and StringBuffer classes modify the object on which they are called?()
    A

    The charAt() method of the String class.

    B

    The toUpperCase() method of the String class.

    C

    The replace() method of the String class.

    D

    The reverse() method of the StringBuffer class.

    E

    The length() method of the StringBuffer class.


    正确答案: D
    解析: 暂无解析

  • 第12题:

    多选题
    Which two allow the class Thing to be instantiated using new Thing()?
    A

    public class Thing { }

    B

    public class Thing { public Thing() {} }

    C

    public class Thing { public Thing(void) {} }

    D

    public class Thing { public Thing(String s) {} }

    E

    public class Thing { public void Thing() {} public Thing(String s) {} }


    正确答案: A,C
    解析: 暂无解析

  • 第13题:

    编写类 String 的构造函数、析构函数和赋值函数

    已知类 String的原型为:

    class String

    {

    public:

    String(const char *str = NULL); // 普通构造函数

    String(const String &other); // 拷贝构造函数

    ~ String(void); // 析构函数

    String & perate =(const String &other); // 赋值函数

    private:

    char *m_data; // 用于保存字符串

    };

    请编写 String的上述 4 个函数。


    正确答案:
     

  • 第14题:

    Which two allow the class Thing to be instantiated using new Thing()?

    • A、 public class Thing { }
    • B、 public class Thing { public Thing() {} }
    • C、 public class Thing { public Thing(void) {} }
    • D、 public class Thing { public Thing(String s) {} }
    • E、 public class Thing { public void Thing() {} public Thing(String s) {} }

    正确答案:A,B

  • 第15题:

    public class Employee{       private String name;  public Employee(String name){           this.name = name;      }  public String getName(){         return name;      } }  public class Manager extends Employee{       private String department;  public Manager(String name,String department){          this.department = department;          super(name);  System.out.println(getName());      }  }  执行语句new Manager(“smith”,”SALES”)后程序的输出是哪项?() 

    • A、 smith
    • B、 null
    • C、 SALES
    • D、 编译错误

    正确答案:D

  • 第16题:

    Given the uncompleted code of a class:     class Person {  String name, department;     int age;  public Person(String n){  name = n; }  public Person(String n, int a){  name = n;  age = a;  }  public Person(String n, String d, int a) {  // doing the same as two arguments version of constructor     // including assignment name=n,age=a    department = d;     }     }  Which expression can be added at the "doing the same as..." part of the constructor?() 

    • A、 Person(n,a);
    • B、 this(Person(n,a));
    • C、 this(n,a);
    • D、 this(name,age);

    正确答案:C

  • 第17题:

    Which methods from the String and StringBuffer classes modify the object on which they are called?()  

    • A、The charAt() method of the String class.
    • B、The toUpperCase() method of the String class.
    • C、The replace() method of the String class.
    • D、The reverse() method of the StringBuffer class.
    • E、The length() method of the StringBuffer class.

    正确答案:D

  • 第18题:

    Given the following code, write a line of code that, when inserted at the indicated location, will make the overriding method in Extension invoke the overridden method in class Base on the current object.   class Base {   public void print( ) {   System.out.println("base");   }   }   class Extention extends Base {   public void print( ) {   System.out.println("extension");   // insert line of implementation here   }   }   public class Q294d {   public static void main(String args[]) {   Extention ext = new Extention( );   ext.print( );   }   }   Fill in a single line of implementation.()


    正确答案:super.print();

  • 第19题:

    Given an EL function declared with:11.  12.spin 13.com.example.Spinner 14. 15.java.lang.String spinIt() 16. 17. Which two are true?()

    • A、The function method must have the signature: public String spin().
    • B、The method must be mapped to the logical name "spin" in the web.xml file.
    • C、The function method must have the signature: public String spinIt().
    • D、The function method must have the signature public static String spin().
    • E、The function method must have the signature: public static String spinIt().
    • F、The function class must be named Spinner, and must be in the package com.example.

    正确答案:E,F

  • 第20题:

    You work as the application developer at Hi-Tech.com. You create a new custom dictionary named MyDictionary. Choose the code segment which will ensure that MyDictionary is type safe?()

    • A、 Class MyDictionary Implements Dictionary (Of String,String)
    • B、 Class MyDictionary Inherits HashTable
    • C、 Class MyDictionary Implements IDictionary
    • D、 Class MyDictionary     End Class     Dim t as New Dictionary (Of String, String)     Dim dict As MyDIctionary= CType (t,MyDictionary)

    正确答案:A

  • 第21题:

    多选题
    Given an EL function declared with:11.  12.spin 13.com.example.Spinner 14. 15.java.lang.String spinIt() 16. 17. Which two are true?()
    A

    The function method must have the signature: public String spin().

    B

    The method must be mapped to the logical name spin in the web.xml file.

    C

    The function method must have the signature: public String spinIt().

    D

    The function method must have the signature public static String spin().

    E

    The function method must have the signature: public static String spinIt().

    F

    The function class must be named Spinner, and must be in the package com.example.


    正确答案: B,F
    解析: 暂无解析

  • 第22题:

    单选题
    If you use ALTER DISKGROUP ... ADD DISK and specify a wildcard for the discovery string, what happens to disks that are already a part of the same or another disk group?()
    A

     The command fails unless you specify the FORCE option.

    B

     The command fails unless you specify the REUSE option.

    C

     The command must be reissued with a more specific discovery string.

    D

     The other disks, already part of the disk group,are ignored.


    正确答案: C
    解析: 暂无解析

  • 第23题:

    单选题
    You work as the application developer at Hi-Tech.com. You create a new custom dictionary named MyDictionary. Choose the code segment which will ensure that MyDictionary is type safe?()
    A

     Class MyDictionary Implements Dictionary (Of String,String)

    B

     Class MyDictionary Inherits HashTable

    C

     Class MyDictionary Implements IDictionary

    D

     Class MyDictionary     End Class     Dim t as New Dictionary (Of String, String)     Dim dict As MyDIctionary= CType (t,MyDictionary)


    正确答案: A
    解析: 暂无解析