网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

A JavaBeans component has the following field:  11. private boolean enabled;  Which two pairs of method declarations follow the JavaBeans standard for accessing this field?()

  • A、 public void setEnabled( boolean enabled) public boolean getEnabled()
  • B、 public void setEnabled( boolean enabled) public void isEnabled()
  • C、 public void setEnabled( boolean enabled) public boolean isEnabled()
  • D、 public boolean setEnabled( boolean enabled) public boolean getEnabled()

参考答案

更多 “ A JavaBeans component has the following field:  11. private boolean enabled;  Which two pairs of method declarations follow the JavaBeans standard for accessing this field?()A、 public void setEnabled( boolean enabled) public boolean getEnabled()B、 public void setEnabled( boolean enabled) public void isEnabled()C、 public void setEnabled( boolean enabled) public boolean isEnabled()D、 public boolean setEnabled( boolean enabled) public boolean getEnabled()” 相关考题
考题 【Java代码】import Java.util.ArrayList;import java.util.List;(1) class AbstractFile{protected String name;public void printName(){System.out.println(name);}public abstract boolean addChild(AbstractFile file);public abstract boolean removeChild(AbstractF ile file);public abstract ListAbstractFile getChildren();}class File extends AbstractFile{public File(String name){this.name=name;}public boolean addChild(AbstractFile file){return false;}public boolean removeChild(AbstractFile file){return false;}public ListAbstractFile getChildren(){return (2) ;}}class Folder extends AbstractFile{private List AbslractFile childList;public Folder(String name){this.name=name;this.childList=new ArrayListAbstractFile();}public boolean addChild(AbstractFile file) { return childList.add(file);}public boolean removeChild(AbstractFile file){return childList.remove(file);}public (3) AbstractFile getChildren(){return (4) ;}}public class Client{public static void main(String[] args){//构造一个树形的文件/目录结构AbstractFile rootFolder= new Folder("c:\\ ");AbstractFile compositeFolder=new Folder("composite");AbstractFile windowsFolder=new Folder("windows");AbstractFile file=new File("TestComposite.java");rootFolder.addChild(compositeFolder) ;rootFolder.addChild(windowsFolder);compositeFolder.addChild(file) ;//打印目录文件树printTree(rootFolder);}private static void printTree(AbslractFile ifile){ifile.printName();List AbslractFile children=ifile.getChildreno:if(children==null) return;for (AbstractFile file:children) {(5) ;}}}该程序运行后输出结果为:c:\compositeTestComposite.javaWindows

考题 下列代码的编译或执行结果是______。public class MyVal{puhlic static void main(String args[]){MyVal m=new MyVal();m.aMethod();}public void aMethod(){boolean b[]=new Boolean[5];System.out.println(b[0]);}A) 1B) nullC) 0D) 编译错误A.B.C.D.

考题 public void testIfA(){if(testIfB(True)){System.out.println(True);}else{System.out.println(Nottrue);}}public Boolean testIfB(Stringstr){return Boolean.valueOf(str);}What is the result when method testIfA is invoked?()A.TrueB.NottrueC.Anexceptionisthrownatruntime.D.Compilationfailsbecauseofanerroratline12.E.Compilationfailsbecauseofanerroratline19.

考题 阅读下面程序 public class My Val{ public static void main(String args[]){ My Val m=new My Val(); m. amethod(); } public void amethod(){ boolean b[]=new Boolean[5]; } } 程序编译或运行结果是A.1B.nullC.D.编译不能过

考题 阅读下列说明和Java代码,将应填入 (n) 处的字句写在答题纸的对应栏内。【说明】现欲构造一文件/目录树,采用组合(Composite)设计模式来设计,得到的类图如6—8所示:【Java代码】import JavA.util.ArrayList;import JavA.util.List;(1)class AbstractFile{protected String name;public void printName(){System.out.println(name);}public abstract boolean addChild(AbstractFile file);public abstract boolean removeChild(AbstractFile file);public abstract ListgetChildren {};}class File extends AbstractFile{public File(String name)(this.name=name;}public boolean addChild(AbstractFile file){return false;}public boolean removeChild(AbstractFile file){return false;}public ListgetChildren(){return (2) ;)}clasS Folder extends AbstractFile{private ListchildList;public Folder(String name){thiS.name=name;this.childList=new ArrayList{};}public boolean addChild(AbstractFile file){return childList.add(file);}public boolean removeChild(AbstractFile file){return childList.remove(file);public (3)getChildren(){return (4) ;)}public class Client{public static void main(String[]args){//构造一个树形的文件/目录结构AbstractFile rootFolder=new Folder(“C:\”’);AbstractFile compositeFolder=new Folder(”composite”);AbstractFile windowsFolder=new Folder(”windows”);AbstractFile file=new File(”TestComposite.java”);rootFOlder.addChild (compositeFolder);rootFolder.addChiid(windowsFolder);compositeFolder.addChild(file);//打印目录文件树printTree(rootFolder);}private static void printTree(AbstractFile ifile){ifile.PrIntName();Listchildren:ifile.getChildren ();if(chiidren==null)return;for(AbstractFile file:children){(5) ;}}}该程序运行后输出结果为:C:\compositeTestComposite.javaWindows

考题 下列代码的编译或执行结果是( )。 public class Myval{ public static void main(string args[]){ MyVal m=new MyVal; aMethod; } public void aMethod{ boolean b[]=new Boolean[5]; System.OUt.println(b[0]); } }A.1B.nullC.0D.编译错误

考题 下列哪个成员方法声明是正确的? ( )A.public abstract final int f(){...}B.public static boolean f(){...}C.static protected void g(a,{...}D.protected private number;

考题 下列哪个成员方法声明是正确的? ( )A.public abstract final int f(){…}B.public static boolean f(){…}C.static protected void g(a,b){…}D.protected private number;

考题 以下哪个是Java应用程序main方法的有效定义? A. public static void main();B. public static void main( String args );C. public static void main( String args[] );D. public static void main( Graphics g );E. public static boolean main( String a[] );

考题 以下哪个方法可以用来获得进度条的当前进度值?()A、public synchronized int getProgress()B、public synchronized void setIndeterminate (boolean indeterminate)C、public synchronized void setProgress(int progress)D、Public final synchronized void incrementProgressBy(int diff)

考题 Which lines of code are valid declarations of a native method when occurring within the declaration of the following class?()    public class Qf575 {   // insert declaration of a native method here   }  A、native public void setTemperature(int kelvin);B、private native void setTemperature(int kelvin);C、protected int native getTemperature();D、public abstract native void setTemperature(int kelvin);E、native int setTemperature(int kelvin) {}

考题 Which statements concerning the following code are true?()   class a {   public a() {}   public a(int i) { this(); }   }   class b extends a {   public boolean b(String msg) { return false; }   }   class c extends b  {  private c() { super(); }   public c(String msg) { this(); }   public c(int i) {}   }  A、The code will fail to compile.B、The constructor in a that takes an int as an argument will never be called as a result of constructing an  object of class b or c.C、Class c has three constructors.D、Objects of class b cannot be constructed.E、At most one of the constructors of each class is called as a result of constructing an object of class c.

考题 11. public void testIfA() {  12. if(testIfB(”True”)) {  13. System.out.println(”True”);  14. } else {  15. System.out.println(”Not true”);  16. }  17. }  18. public Boolean testIfB(String str) {  19. return Boolean.valueOf(str);  20. }  What is the result when method testIfA is invoked?() A、 TrueB、 Not trueC、 An exception is thrown at runtime.D、 Compilation fails because of an error at line 12.E、 Compilation fails because of an error at line 19.

考题 Which is a method of the MouseMotionListener interface?()A、 Public void mouseMoved(MouseEvent)B、 Public boolean mouseMoved(MouseEvent)C、 Public void mouseMoved(MouseMotionEvent)D、 Public boolean MouseMoved(MouseMotionEvent)E、 Public boolean mouseMoved(MouseMotionEvent)

考题 Which the two demonstrate an “is a” relationship?()A、 public interface Person {}  Public class Employee extends Person {}B、 public interface Shape {}  public interface Rectangle extends Shape {}C、 public interface Color {}  public class Shape { private Color color; }D、 public class Species {}  public class Animal { private Species species; }E、 interface Component {} Class Container implements Component {private Component [] children;

考题 Which two demonstrate an “is a” relationship?()   A、 public interface Person { }  public class Employee extends Person { }B、 public interface Shape { }  public class Employee extends Shape { }C、 public interface Color { }  public class Employee extends Color { }D、 public class Species { }  public class Animal (private Species species;)E、 interface Component { }  Class Container implements Component ( Private Component[ ]children;  )

考题 public class test (      private static int j = 0;  private static boolean methodB(int k) (  j += k;  return true;  )  public static void methodA(int  i)(  boolean b:     b = i  10 | methodB (4);  b = i  10 || methodB (8);  )  public static void main (String args[])(   methodA (0);  system.out.printIn(j);  )  )   What is the result?()  A、 The program prints “0”B、 The program prints “4”C、 The program prints “8”D、 The program prints “12”E、 The code does not complete.

考题 public void testIfA(){ if(testIfB("True")){ System.out.println("True"); }else{ System.out.println("Nottrue"); } } public Boolean testIfB(Stringstr){ return Boolean.valueOf(str); } What is the result when method testIfA is invoked?()A、TrueB、NottrueC、Anexceptionisthrownatruntime.D、Compilationfailsbecauseofanerroratline12.E、Compilationfailsbecauseofanerroratline19.

考题 public class Key {  private long id1;  private long 1d2;  // class Key methods  }  A programmer is developing a class Key, that will be used as a key in a standard java.util.HashMap. Which two methods should be overridden to assure that Key works correctly as a key?()A、 public int hashCode()B、 public boolean equals(Key k)C、 public int compareTo(Object o)D、 public boolean equals(Object o)E、 public boolean compareTo(Key k)

考题 多选题Which statements concerning the following code are true?()   class a {   public a() {}   public a(int i) { this(); }   }   class b extends a {   public boolean b(String msg) { return false; }   }   class c extends b  {  private c() { super(); }   public c(String msg) { this(); }   public c(int i) {}   }AThe code will fail to compile.BThe constructor in a that takes an int as an argument will never be called as a result of constructing an  object of class b or c.CClass c has three constructors.DObjects of class b cannot be constructed.EAt most one of the constructors of each class is called as a result of constructing an object of class c.

考题 多选题A JavaBeans component has the following field:  11. private boolean enabled;  Which two pairs of method declarations follow the JavaBeans standard for accessing this field?()Apublic void setEnabled( boolean enabled) public boolean getEnabled()Bpublic void setEnabled( boolean enabled) public void isEnabled()Cpublic void setEnabled( boolean enabled) public boolean isEnabled()Dpublic boolean setEnabled( boolean enabled) public boolean getEnabled()

考题 单选题下列代码的编译或执行结果是(  )。 public class MyVal{ public static void main(String args[]){ MyVal m = new MyVal(); m.aMethod(); } public void aMethod(){ boolean b[] = new Boolean[5]; System.out.println(b[0]); } }A 1B nullC 0D 编译错误

考题 单选题Which is a method of the MouseMotionListener interface?()A  Public void mouseMoved(MouseEvent)B  Public boolean mouseMoved(MouseEvent)C  Public void mouseMoved(MouseMotionEvent)D  Public boolean MouseMoved(MouseMotionEvent)E  Public boolean mouseMoved(MouseMotionEvent)

考题 单选题11. public void testIfA() {  12. if(testIfB(”True”)) {  13. System.out.println(”True”);  14. } else {  15. System.out.println(”Not true”);  16. }  17. }  18. public Boolean testIfB(String str) {  19. return Boolean.valueOf(str);  20. }  What is the result when method testIfA is invoked?()A  TrueB  Not trueC  An exception is thrown at runtime.D  Compilation fails because of an error at line 12.E  Compilation fails because of an error at line 19.

考题 多选题A JavaBeans component has the following field:   11. private boolean enabled;   Which two pairs of method declarations follow the JavaBeans standard for accessing this field?()AABBCCDD

考题 多选题public class Key {  private long id1;  private long 1d2;  // class Key methods  }  A programmer is developing a class Key, that will be used as a key in a standard java.util.HashMap. Which two methods should be overridden to assure that Key works correctly as a key?()Apublic int hashCode()Bpublic boolean equals(Key k)Cpublic int compareTo(Object o)Dpublic boolean equals(Object o)Epublic boolean compareTo(Key k)

考题 单选题public class test (      private static int j = 0;  private static boolean methodB(int k) (  j += k;  return true;  )  public static void methodA(int  i)(  boolean b:     b = i  10 | methodB (4);  b = i  10 || methodB (8);  )  public static void main (String args[])(   methodA (0);  system.out.printIn(j);  )  )   What is the result?()A  The program prints “0”B  The program prints “4”C  The program prints “8”D  The program prints “12”E  The code does not complete.