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

题目内容 (请给出正确答案)
单选题
J2EE中,对于简单属性的方法:public Color getColor(){……}和 public void setColor(Color c){……}假定color是类中的属性,在方法体内可以()
A

在getColor方法体内只能有一行代码:return color;在setColor方法体内只能有一行代码:this.color=c

B

在getColor方法体内只能有一行代码:return color;在setColor方法体内一定要有该行代码:this.color=c;但还可以有其它的代码

C

在getColor方法体内一定要 有该行代码:return Color;但还可以有其它的代码,在setColor方法体内只能有一行代码:this.color=c

D

在getColor方法体内一定要有该行代码


参考答案

参考解析
解析: 暂无解析
更多 “单选题J2EE中,对于简单属性的方法:public Color getColor(){……}和 public void setColor(Color c){……}假定color是类中的属性,在方法体内可以()A 在getColor方法体内只能有一行代码:return color;在setColor方法体内只能有一行代码:this.color=cB 在getColor方法体内只能有一行代码:return color;在setColor方法体内一定要有该行代码:this.color=c;但还可以有其它的代码C 在getColor方法体内一定要 有该行代码:return Color;但还可以有其它的代码,在setColor方法体内只能有一行代码:this.color=cD 在getColor方法体内一定要有该行代码” 相关考题
考题 在J2EE中,对于简单属性的方法:publicColorgetColor(){......}和publicvoidsetColor(Colorc){....}假定color是类中的属性,在方法体内可以() A.在getColor方法体内只能有一行代码:returncolor;在setColor方法体内只能有一行代码:this.color=c;B.在在getColor方法体内只能有一行代码:returncolor;在setColor方法体内一定要有该行代码:this.color=c;;但还可以有其他的代码C.在getColor方法体内一定要有一行代码:returncolor但还可以有其它代码;在setColor方法体内只能有一行代码:this.color=c;D.在getColor方法内一定要有该行代码

考题 J2EE中,对于简单属性的方法:publicColorgetColor(){……}和publicvoidsetColor(Colorc){……}假定color是类中的属性,在方法体内可以() A.在getColor方法体内只能有一行代码:returncolor;在setColor方法体内只能有一行代码:this.color=cB.在getColor方法体内只能有一行代码:returncolor;在setColor方法体内一定要有该行代码:this.color=c;但还可以有其它的代码C.在getColor方法体内一定要有该行代码:returnColor;但还可以有其它的代码,在setColor方法体内只能有一行代码:this.color=cD.在getColor方法体内一定要有该行代码

考题 在J2EE中,对于简单属性的方法:publicColorgetColor(){…}和publicVoidsetColor(Colorc){…}假定color是类中的属性,在方法体内可以() A.在getColor方法体内只能有一行代码:returncolor;在setColor方法体内只能有一行代码:this.color=c;B.在getColor方法体内只能有一行代码:returncolor;在setColor方法体内一定有该行代码:this.color=c;但还可以有其他的代码C.在getColor方法体内一定有该行代码:returncolor;但还可以有其他的代码,在setColor方法体内只能有该行代码:this.color=c;D.在getColor方法体内一定要有该行代码:returncolor;但还可以有其他的代码,在setColor方法体内一定有该行代码:this.color=c;但还可以有其他的代码

考题 下面程序是一个计时器,从1000秒开始倒计时,直到为0结束。在界面上有两个按钮,一个可以暂停计时,另一个可以继续已经暂停的计时。请更正题中带下划线的部分。注意:不改动程序的结构,不得增行或删行import java.awt.*;import java.awt.event.*;import java.applet.Applet;public class Example3_4 extends Applet{public Color color = Color.red;private int num= 1000;public Counter theCounter;private Button stop;private Button start;public void init(){stop = new Button("暂停");start = new Button ("继续");theCounter = new Counter(this);stop.addActionListener(new Lst() implements ActionListener{public void actionPerformed(ActionEvent e){theCounter.sus();}});start.addActionListener(new SuspenListener());add(start);add(stop);theCounter.start();}public void paint(Graphics g){g.setCotor(color);g.drawString(String.valueOf(num),50,50);}public void setInt(int i){num=i;}class SuspenListener implements ActionListener{public void actionPerformed(ActionEvent e){theCounter.conti ();}}}public class Counter extends Thread{Example3_4 example;boolean isHold;Counter (Example3_4 ex){this.example = ex;isHold = false;}public void sus(){isHold = true;}public synchronized void conti(){isHold = false;notify();}public void run(){for (int i = 1000; i>0; i--){if (i%2 == 1)example.color = Color.red;elseexample.color = Color.blue;example.setInt(i);example.repaint();try{sleep(1000);synchronized {while(isHold)wait ( );}}catch (InterruptedException ie){}}}}<HTML><HEAD><TITLE>Example3_4</TITLE></HEAD><BO

考题 指出下列哪个方法与方法public void add(int a){}为合理的重载方法。()A public int add(int a)B public void add(long a)C public void add(int a,int b)D public void add(float a)

考题 定义属性错误的是()。 A、public int A{ get {return "100"}}B、public int A( get;set;)C、public int A{ get;set;}D、public int A{ get;}

考题 阅读以下函数说明和Java代码,将应填入(n)处的字句写在对应栏内。【说明】下面的程序先构造Point类,再顺序构造Ball类。由于在类Ball中不能直接存取类Point中的xCoordinate及yCoordinate属性值,Ball中的toString方法调用Point类中的toStrinS方法输出中心点的值。在MovingBsll类的toString方法中,super.toString调用父类Ball的toString方法输出类Ball中声明的属性值。【Java代码】//Point.java文件public class Point{private double xCoordinate;private double yCoordinate;public Point(){}public Point(double x,double y){xCoordinate=x;yCoordinate=y;}public String toStrthg(){return"("+Double.toString(xCoordinate)+","+Double.toString(yCoordinate)+")";}//other methods}//Ball.java文件public class Ball{private (1);//中心点private double radius;//半径private String color;//颜色public Ball(){}public Ball(double xValue, double yValue, double r){//具有中心点及其半径的构造方法center=(2);//调用类Point中的构造方法radius=r;}public Ball(double xValue, double yValue, double r, String c){//具有中心点、半径和颜色的构造方法(3);//调用3个参数的构造方法color=c;}public String toString(){return "A ball with center"+center.toString()+",radius "+Double.toString(radius)+",color"+color;}//other methods}class MovingBall (4) {private double speed;public MovingBall(){}public MoyingBall(double xValue, double yValue, double r, String c, double s){(5);//调用父类Ball中具有4个参数的构造方法speed=s;}public String toString(){return super.toString()+",speed"+Double.toString(speed);}//other methods}public class test{public static void main(String args[]){MovingBall mb=new MovingBall(10,20,40,"green",25);System.out.println(mb);}}

考题 WindowListener 中可以实现窗口关闭功能的方法是______。A.public void windowOpened(WindowEvent e)B.public void windowClosed(WindowEvent e)C.public void windowClosing(WindowEvent e)D.public void windowDeactivated(WindowEvent e)

考题 下面哪个方法是 public void example(){...} 的重载方法?A、private void example( int m){...}B、public int example(){...}C、public void example2(){...}D、public int example(int m, float f){...}

考题 指出下列哪个方法与方法public void add(int a){}为错误的重载方法()A、public int add(int a)B、public void add(long a)C、public int add(long a)D、public void add(float a)

考题 以下程序的编译和运行结果为?abstract class Base{abstract public void myfunc();public void another(){System.out.println("Another method");}}public class Abs extends Base{public static void main(String argv[]){Abs a = new Abs();A.amethod();}public void myfunc(){System.out.println("My Func");}public void amethod(){myfunc();}}A.输出结果为 My FuncB.编译指示 Base 类中无抽象方法C.编译通过,但运行时指示Base 类中无抽象方法D.编译指示Base 类中的myfunc方法无方法体,没谁会喜欢该方法。

考题 下列哪些是方法public  int  add (int a)的重载方法?() A、  public  int  add (long a);B、  public  void  add (int a);C、  public void add (long a);D、  public  int  add (float a);

考题 在J2EE中,对于简单属性的方法: public Color getColor(){......}和 public void setColor(Color  c){....} 假定color是类中的属性,在方法体内可以() A、在getColor方法体内只能有一行代码:return color;在setColor方法体内只能有一行代码:this.color=c;B、在在getColor方法体内只能有一行代码:return color;在setColor方法体内一定要有该行代码:this.color=c;;但还可以有其他的代码C、在getColor方法体内一定要有一行代码:return color但还可以有其它代码;在setColor方法体内只能有一行代码:this.color=c;D、在getColor方法内一定要有该行代码

考题 如果获取XML文档中某一行的数据,需调用()方法。A、public void setDocumentLocator()B、public void unparsedEntityDecl()C、public void fatalError()D、public void startDocument()

考题 当解析器解析到文档中命名空间,会调用()方法。A、public void startPrefixMapping()B、public void startDocument()C、public void setDocumentLocator()D、public void characters()

考题 当解析器解析到文档的实体时,会调用()方法。A、public InputSource resolveEntity()B、public void fatalError()C、public void characters()D、public void startDocument()

考题 指出下列方法与方法publicvoidadd(inta){}中为合理的重载方法的是()。A、public int add(inta)B、public void add(longa)C、public void add(inta,intb)D、public void add(floata)

考题 在J2EE中,对于简单属性的方法: public Color getColor(){…} 和public Void setColor(Color c){…} 假定color是类中的属性,在方法体内可以() A、  在getColor方法体内只能有一行代码:return color; 在setColor方法体内只能有一行代码: this.color=c;B、  在getColor方法体内只能有一行代码:return color; 在setColor方法体内一定有该行代码: this.color=c;但还可以有其他的代码C、  在getColor方法体内一定有该行代码:return color; 但还可以有其他的代码, 在setColor方法体内只能有该行代码: this.color=c;D、  在getColor方法体内一定要有该行代码:return color; 但还可以有其他的代码,在setColor方法体内一定有该行代码: this.color=c;但还可以有其他的代码

考题 Given:  1. public class Method Over {  2. public void set Var (int a, int b, float c) {  3. }  4. }   Which two overload the set Var method()?A、 private void set Var(int a, float c, int b) {}B、 protected void set Var(int a, int b, float c) {}C、 public int set Var(int a, float c, int b) {return a:}D、 public int set Var(int a, int b, float c) {return a:}E、 protected float set Var(int a, int b, float c) {return c:}

考题 在j2ee中,以下是firevetoablechange方法的正确的原型的是() A、public void fireVetoableChange(Object  oldValue,Object newValue)B、 public void fireVetoableChange(String  propertyName,Object newValue)C、 public void fireVetoableChange(String  propertyName, Object  oldValue ,Object newValue)throws PropertyVetoExceptionD、 public void fireVetoableChange(String  propertyName, Object  oldValue ,Object newValue)

考题 下面关于Java应用程序中main方法的写法,合法的是()。A、public static void main()B、public static void main(Stringargs[])C、public static int main(String[]arg)D、public void main(Stringarg[])

考题 下列方法中,与方法public void add(inta){}为合理重载的方法是()。A、public int add(int a)B、public void add(long a)C、public void add(int a)D、public void add(int a,int b)

考题 在J2EE中,以下是firePropertyChange的原型,正确的是()。 A、public void firePropertyChange(PropertyChangeListener l,String oldValue, String newValue)B、public void firePropertyChange(String propertyName, Object oldValue, Object newValue)C、public void firePropertyChange(PropertyChangeSupport changes)D、public void firePropertyChange(Object oldValue, Object newValue)

考题 单选题public class Parent{     public void change(int x){} }  public class Child extends Parent{     //覆盖父类change方法  }  下列哪个声明是正确的覆盖了父类的change方法?()A  protected void change(int x){}B  public void change(int x, int y){}C  public void change(String s){}D  public void change(int x){}

考题 单选题在J2EE中,对于简单属性的方法: public Color getColor(){......}和 public void setColor(Color  c){....} 假定color是类中的属性,在方法体内可以()A 在getColor方法体内只能有一行代码:return color;在setColor方法体内只能有一行代码:this.color=c;B 在在getColor方法体内只能有一行代码:return color;在setColor方法体内一定要有该行代码:this.color=c;;但还可以有其他的代码C 在getColor方法体内一定要有一行代码:return color但还可以有其它代码;在setColor方法体内只能有一行代码:this.color=c;D 在getColor方法内一定要有该行代码

考题 单选题在J2EE中,对于简单属性的方法: public Color getColor(){…} 和public Void setColor(Color c){…} 假定color是类中的属性,在方法体内可以()A   在getColor方法体内只能有一行代码:return color; 在setColor方法体内只能有一行代码: this.color=c;B   在getColor方法体内只能有一行代码:return color; 在setColor方法体内一定有该行代码: this.color=c;但还可以有其他的代码C   在getColor方法体内一定有该行代码:return color; 但还可以有其他的代码, 在setColor方法体内只能有该行代码: this.color=c;D   在getColor方法体内一定要有该行代码:return color; 但还可以有其他的代码,在setColor方法体内一定有该行代码: this.color=c;但还可以有其他的代码

考题 单选题J2EE中,对于简单属性的方法:public Color getColor(){……}和 public void setColor(Color c){……}假定color是类中的属性,在方法体内可以()A 在getColor方法体内只能有一行代码:return color;在setColor方法体内只能有一行代码:this.color=cB 在getColor方法体内只能有一行代码:return color;在setColor方法体内一定要有该行代码:this.color=c;但还可以有其它的代码C 在getColor方法体内一定要 有该行代码:return Color;但还可以有其它的代码,在setColor方法体内只能有一行代码:this.color=cD 在getColor方法体内一定要有该行代码

考题 单选题在j2ee中,以下是firevetoablechange方法的正确的原型的是()A public void fireVetoableChange(Object  oldValue,Object newValue)B  public void fireVetoableChange(String  propertyName,Object newValue)C  public void fireVetoableChange(String  propertyName, Object  oldValue ,Object newValue)throws PropertyVetoExceptionD  public void fireVetoableChange(String  propertyName, Object  oldValue ,Object newValue)