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

题目内容 (请给出正确答案)
单选题
public class Test {  private static float[] f = new float[2];  public static void main(String args[]) {  System.out.println(“f[0] = “ + f[0]);  }  }   What is the result?()
A

 f[0] = 0

B

 f[0] = 0.0

C

 Compilation fails.

D

 An exception is thrown at runtime.


参考答案

参考解析
解析: 暂无解析
更多 “单选题public class Test {  private static float[] f = new float[2];  public static void main(String args[]) {  System.out.println(“f[0] = “ + f[0]);  }  }   What is the result?()A  f[0] = 0B  f[0] = 0.0C  Compilation fails.D  An exception is thrown at runtime.” 相关考题
考题 下列代码中,将引起编译错误的行是( )。 ① public class test{ ② public static void main(String args[]){ ③ float f=0.0; ④ f+=0; ⑤ } ⑥ }A.第2行B.第3行C.第4行D.第6行

考题 下列代码的执行结果是( )。 public class Test { public static void main ( String args[]) { float f=5.0f; int i=4; System.out.println((f++) *(--i)); } }A.20B.20.0C.15D.15.0

考题 已知如下类说明: public class Test { private float f = 1.0f; int m = 12; static int n=1; public static void main(String arg[]) { Test t = new Test(); // 程序代码… } } 如下哪个使用是正确的?() A.t.fB.this.nC.Test.mD.Test.n

考题 类Test定义如下,将下列______方法插入③行处是不合法的。 ( )①public class Test{②public float Method(float a,float b){}③④}A.public float Method(float a,float b,float c){}B.public float Method(float c,float d){}C.public int Method(int a,int b){}D.private float Method(int a,int b,int c){}

考题 已知有下列类的说明,则下列哪个语句是正确的?public class Test { private float f=1.0f; int m=12; static int n=1; public static void main(String arg[]) { Test t= new Test(); }}A.t.f;B.this. nC.Test.m;D.Test.f;

考题 已知有下列类的说明,则下列( )语句是正确的。 publicClass Test{ private float f=1.0f; int m=12; static int n=1: public static void main(Stringarg[]){ Test t=new Test(): } }A.t.f;B.this.n;C.Test.m;D.Test.f;

考题 下面代码的执行结果是( )。 public class test { public static void main (String args[]) { float m=5.0f; int n=4; System.out.println((++m)*(n--)); } }A.20.0B.20C.24.0D.24

考题 已知有下面的类说明: public class Test4 { private float f=1.0f; int m=12; static int n=1; public static void main(String args[]) { Test4 e=new Test4(); } } 在main()方法中,下面哪个的使用是正确的? ( )A.e.fB.this.nC.Test4.mD.Test4.f

考题 类Test定义如下,将下列( )方法插入③行处是不合法的。 ①publicClass Test{ ②public float Method(floatA,float b){} ③ ④}A.public float Method(floatA,float b,floatC){}B.public float Method(noatC,float d) {}C.public int Method(intA,int b){}D.private float Method(intA,int b,intC){}

考题 下列代码执行结果为 ( )public class Test{ public static void main(String args[]){ float p=0f; int q=3; System.out.println(++p)*(q--)); }}A.16B.24C.16D.24

考题 下列代码的执行结果是( )。 public class Test1 { public static void main(String args[]) float t = 0f; int q = 5; System.out.println((t++)*(--q)); }A.40B.40C.36D.36

考题 类testl定义如下: public class test1 { public float amethod(float a,float b){ } }A.public foat amethod(float a,float b,foat c){ }B.public float amethod(float c,float d){ }C.public int amethod(int a,int b){ }D.private float amethod(int a,int b,int c){ }

考题 已知有下列类的说明,则下列哪个语句是正确的? ( ) public class Test { private float f=1.0f; int m=2; static int n=1; public static void main(String arg[]) { Test t=new Test(); } }A.t.f;B.this,n;C.Test.m;D.Test.f;

考题 类Test定义如下,将下列哪个方法插入③行处是不合法的( )?① public class Test{② public float Method(float a,float B) { }③ ______④ }A.public float Method(float a,float b,float C) { }B.public float Method(float c,float d){ }C.public int Method(int a,int B) { }private float Method(int a,int b,int C) { }D.private float Method(int a,int b,int C) { }

考题 已知有下面的类说明: pubic class Test4 { private float f=0f; int m=12; static int n=1; public static void main(String args[]) { Test4 e=new Test4(); } } 在main()方法中,下面( )使用是正确的。A.e.fB.this.nC.Test4.mD.Test4.f

考题 阅读下列说明和Java代码,将应填入 (n)处的字句卸载答题纸的对应栏内. 【说明】 某实验室欲建立一个实验室环境监测系统,能够显示实验室的温度、湿度以及洁净度等环境数据。当获取到最新的环境测量数据时,显示的环境数据能够更新。 现在采用观察者(Observer)模式来开发该系统。观察者模式的类图如图6-1所示。【Java代码】 import java.util.*; interface Observer { public void update(float temp, float humidity, float cleanness); } interface Subject { public void registerObserver(Observer o); //注册对主题感兴趣的观察者 public void removeObserver(Observer o); //删除观察者 public void notifyObservers(); //当主题发生变化时通知观察者 } class EnvironmentData implements (1) { private ArrayList observers; private float temperature, humidity, cleanness; public EnvironmentData() { observers = new ArrayList(); } public void registerObserver(Observer o) { observers.add(o); } public void removeObserver(Observer o) { /* 代码省略 */ } public void notifyObservers() { for (int i = 0; i observers.size(); i++) { Observer observer = (Observer)observers.get(i); (2) ; } } public void measurementsChanged() { (3) ; } public void setMeasurements(float temperature, float humidity, float cleanness) { this.temperature = temperature; this.humidity = humidity; this.cleanness = cleanness; (4) ; } } class CurrentConditionsDisplay implements (5) { private float temperature; private float humidity; private float cleanness; private Subject envData; public CurrentConditionsDisplay(Subject envData) { this.envData = envData; (6) ; } public void update(float temperature, float humidity, float cleanness) { this.temperature = temperature; this.humidity = humidity; this.cleanness = cleanness; display(); } public void display() {/* 代码省略 */ } } class EnvironmentMonitor{ public static void main(String[] args) { EnvironmentData envData = new EnvironmentData(); CurrentConditionsDisplay currentDisplay = new CnrrentConditionsDisplay(envData); envData.setMeasurements(80, 65, 30.4f); } }

考题  public class ArrayTest {   public static void main (Stringargs) {   float f1, f2;   f1 = new float [10];  f2 = f1;   System.out.printIn (“f2[0]=” + f2[0]);   }  }   What is the result?()A、 It prints f2[0] = 0.0B、 It prints f2[0] = NaNC、 An error at line 5 causes compile to fail.D、 An error at line 6 causes compile to fail.E、 An error at line 6 causes an exception at runtime.

考题 1. class BaseClass {  2. private float x = 1.of;  3. protected float getVar() { return x; }  4. }  5. class SubClass extends BaseClass {  6. private float x = 2.Of;  7. // insert code here 8. }   Which two are valid examples of method overriding when inserted at line 7?() A、 float getVar() { return x; }B、 public float getVar() { return x; }C、 public double getVar() { return x; }D、 protected float getVar() { return x; }E、 public float getVar(float f) { return f; }

考题 public class ArrayTest {  public static void main(String[] args) {  float fl[], f2[];  fl = new float[10];  f2 = f1;  System.out.println(“f2[0]= “ + f2[0]);  }  }  What is the result?()  A、 It prints f2[0] = 0.0.B、 It prints f2[0] = NaN.C、 An error at line 5 causes compile to fail.D、 An error at line 6 causes compile to fail.E、 An error at line 6 causes an expectation at runtime.

考题 1. abstract class AbstractIt {  2. abstract float getFloat();  3. }  4. public class AbstractTest extends AbstractIt {  5. private float f1 = 1.0f;  6. private float getFloat() { return f1; }  7. }  What is the result?() A、 Compilation succeeds.B、 An exception is thrown.C、 Compilation fails because of an error at line 2.D、 Compilation fails because of an error at line 6.

考题 public class Test {  private static float[] f = new float[2];  public static void main(String args[]) {  System.out.println(“f[0] = “ + f[0]);  }  }   What is the result?()  A、 f[0] = 0B、 f[0] = 0.0C、 Compilation fails.D、 An exception is thrown at runtime.

考题 abstract class abstrctIt {   abstract float getFloat ();   }   public class AbstractTest extends AbstractIt {   private float f1= 1.0f;   private float getFloat () {return f1;}   }   What is the result? ()A、 Compilation is successful.B、 An error on line 6 causes a runtime failure.C、 An error at line 6 causes compilation to fail.D、 An error at line 2 causes compilation to fail.

考题 类Test1定义如下: 1.public class Test1{ 2. public float aMethod(float a,float b){ return 0;} 3. 4.} 将以下哪种方法插入行3是不合法的。()A、public float aMethod(float a, float b,float c){ return 0;}B、public float aMethod(float c,float d){ return 0;}C、public int aMethod(int a, int b){ return 0;}D、private float aMethod(int a,int b,int c){ return 0;}

考题 class BaseClass{  private float x= 1.0f;  protected void setVar (float f) {x = f;}  }  class SubClass extends BaseClass   {  private float x = 2.0f;  //insert code here  }   Which two are valid examples of method overriding?()        A、 Void setVar(float f) {x = f;}B、 Public void setVar(int f) {x = f;}C、 Public void setVar(float f) {x = f;}D、 Public double setVar(float f) {x = f;}E、 Public final void setVar(float f) {x = f;}F、 Protected float setVar() {x=3.0f; return 3.0f; }

考题 单选题类Test1定义如下: 1.public class Test1{ 2. public float aMethod(float a,float b){ return 0;} 3. 4.} 将以下哪种方法插入行3是不合法的。()A public float aMethod(float a, float b,float c){ return 0;}B public float aMethod(float c,float d){ return 0;}C public int aMethod(int a, int b){ return 0;}D private float aMethod(int a,int b,int c){ return 0;}

考题 单选题1. abstract class AbstractIt {  2. abstract float getFloat();  3. }  4. public class AbstractTest extends AbstractIt {  5. private float f1 = 1.0f;  6. private float getFloat() { return f1; }  7. }  What is the result?()A  Compilation succeeds.B  An exception is thrown.C  Compilation fails because of an error at line 2.D  Compilation fails because of an error at line 6.

考题 单选题abstract class abstrctIt {  abstract float getFloat ();  } public class AbstractTest extends AbstractIt { private float f1= 1.0f;  private float getFloat () {return f1;}  }   What is the result?()A  Compilation is successful.B  An error on line 6 causes a runtime failure.C  An error at line 6 causes compilation to fail.D  An error at line 2 causes compilation to fail.

考题 单选题public class Test {  private static float[] f = new float[2];  public static void main(String args[]) {  System.out.println(“f[0] = “ + f[0]);  }  }   What is the result?()A  f[0] = 0B  f[0] = 0.0C  Compilation fails.D  An exception is thrown at runtime.