单选题1. public class ReturnIt {  2. return Type methodA(byte x, double y) {  3. return (short)x / y * 2;  4. }  5. }  What is the narrowest valid returnType for methodA in line2?()A intB byteC longD shortE floatF double

单选题
1. public class ReturnIt {  2. return Type methodA(byte x, double y) {  3. return (short)x / y * 2;  4. }  5. }  What is the narrowest valid returnType for methodA in line2?()
A

 int

B

 byte

C

 long

D

 short

E

 float

F

 double


参考解析

解析: 暂无解析

相关考题:

1. public class ReturnIt {  2. return Type methodA(byte x, double y) {  3. return (long)x / y * 2;  4. }  5. }  What is the narrowest valid returnType for methodA in line2?()  A、 intB、 byteC、 longD、 shortE、 floatF、 double

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; }

1. public class Target {  2. private int i = 0;  3. public int addOne() {  4. return ++i;  5. }  6. }  And:  1. public class Client {  2. public static void main(String[] args) {  3. System.out.println(new Target().addOne());  4. }  5. }  Which change can you make to Target without affecting Client?() A、 Line 4 of class Target can be changed to return i++;B、 Line 2 of class Target can be changed to private int i = 1;C、 Line 3 of class Target can be changed to private int addOne() {D、 Line 2 of class Target can be changed to private Integer i = 0;

public class TestA{    public void methodA() throws IOException{        //……    } }  public class TestB extends TestA{    public void methodA() throws EOFException{        //……   } }  public class TestC extends TestA{    public void methodA() throws Exception{        //……   } }  当编译类TestC的时候,结果是哪项?() A、 正常B、 编译错误C、 运行错误D、 以上都不对

1. public class A {  2. public void doit() {  3. }  4. public String doit() {  5. return “a”;  6. }  7. public double doit(int x) {  8. return 1.0;  9. }  10.}  What is the result?() A、 An exception is thrown at runtime.B、 Compilation fails because of an error in line 7.C、 Compilation fails because of an error in line 4.D、 Compilation succeeds and no runtime errors with class A occur.

Given classes defined in two different files:  1. package util;  2. public class BitUtils {  3. private static void process(byte[] b) { }  4. }  1. package app;  2. public class SomeApp {  3. public static void main(String[] args) {  4. byte[] bytes = new byte[256];  5. // insert code here  6. }  7. }  What is required at line 5 in class SomeApp to use the process method of BitUtils?() A、 process(bytes);B、 BitUtils.process(bytes);C、 app.BitUtils.process(bytes);D、 util.BitUtils.process(bytes);E、 import util.BitUtils. *; process(bytes);F、 SomeApp cannot use the process method in BitUtils.

public class X {  public X aMethod() { return this;}  }  public class Y extends X {  }  Which two methods can be added to the definition of class Y?()A、 public void aMethod() {}B、 private void aMethod() {}C、 public void aMethod(String s) {}D、 private Y aMethod() { return null; }E、 public X aMethod() { return new Y(); }

现有:   1. class Synapse {    2.    protected int gap() { return 7; }    3. }   4.     5. class Creb extends Synapse {    6.   // insert code here   7. }    分别插入到第 6 行,哪三行可以编译?()A、 int gap() { return 7; }B、 public int gap() { return 7; }C、 private int gap(int x) { return 7; }D、 protected Creb gap() { return this; }E、 public int gap() { return Integer.getInteger ("42"); }

public class OuterClass {  private double d1  1.0;  //insert code here   }   You need to insert an inner class declaration at line2. Which two inner class declarations are valid?() A、 static class InnerOne {  public double methoda() {return d1;}  }B、 static class InnerOne {  static double methoda() {return d1;} }C、 private class InnerOne {  public double methoda() {return d1;} }D、 protected class InnerOne {  static double methoda() {return d1;} }E、 public abstract class InnerOne {  public abstract double methoda();  }

1. public class returnIt (  2. returnType methodA(byte x, double y) (  3. return (short) x/y * 2;  4. )  5. )   What is the valid returnType for methodA in line 2?()  A、 IntB、 ByteC、 LongD、 ShortE、 FloatF、 Double

Given:  1.  public class ConstOver {  2.  public constOver(int x, int y, int z) {  3.  }  4.  }   Which two overload the ConstOver Constructor?()A、 ConstOver() {}B、 protected int ConstOver(){}C、 private ConstOver(int z, int y, byte x ) {}D、 public Object ConstOver(Int x, int y, int z) {}E、 pubic void ConstOver (byte x, byte y, byte z) {}

1. public class OuterClass {  2. private double d1 = 1.0;  3. // insert code here  4. }  Which two are valid if inserted at line 3?()  A、 static class InnerOne { public double methoda() { return d1; } }B、 static class InnerOne { static double methoda() { return d1; } }C、 private class InnerOne { public double methoda() { return d1; } }D、 protected class InnerOne { static double methoda() { return d1; } }E、 public abstract class InnerOne { public abstract double methoda(); }

1. class super {  2. public float getNum() {return 3.0f;}  3. }  4.    5. public class Sub extends Super { 6.   7. }   Which method, placed at line 6, will cause a compiler error?()  A、  Public float getNum()   {return 4.0f; }B、  Public void getNum ()  { }C、  Public void getNum (double d)   { }D、  Public double getNum (float d) {retrun 4.0f; }

public class returnIt (    returnType methodA(byte x, double y) (   return (short) x/y * 2;   )  )   What is the valid returnType for methodA in line 2?()A、 IntB、 ByteC、 LongD、 ShortE、 FloatF、 Double

1. public class Blip {  2. protected int blipvert(int x) { return 0; }  3. }  4. class Vert extends Blip {  5. // insert code here  6. }  Which five methods, inserted independently at line 5, will compile?()  A、 public int blipvert(int x) { return 0; }B、 private int blipvert(int x) { return 0; }C、 private int blipvert(long x) { return 0; }D、 protected long blipvert(int x, int y) { return 0; }E、 protected int blipvert(long x) { return 0; }F、 protected long blipvert(long x) { return 0; }G、protected long blipvert(int x) { return 0; }

单选题1. public class returnIt (  2. returnType methodA(byte x, double y) (  3. return (short) x/y * 2;  4. )  5. )   What is the valid returnType for methodA in line 2?()A IntB ByteC LongD ShortE FloatF Double

单选题1. public class A {  2. public void doit() {  3. }  4. public String doit() {  5. return “a”;  6. }  7. public double doit(int x) {  8. return 1.0;  9. }  10.}  What is the result?()A An exception is thrown at runtime.B Compilation fails because of an error in line 7.C Compilation fails because of an error in line 4.D Compilation succeeds and no runtime errors with class A occur.

单选题public class returnIt (    returnType methodA(byte x, double y) (   return (short) x/y * 2;   )  )   What is the valid returnType for methodA in line 2?()A IntB ByteC LongD ShortE FloatF Double

单选题Given classes defined in two different files:  1. package util;  2. public class BitUtils {  3. public static void process(byte[]) { /* more code here */ }  4. }  1. package app;  2. public class SomeApp {  3. public static void main(String[] args) {  4. byte[] bytes = new byte[256];  5. // insert code here  6. }  7. }  What is required at line 5 in class SomeApp to use the process method of BitUtils?()A process(bytes);B BitUtils.process(bytes);C util.BitUtils.process(bytes);D SomeApp cannot use methods in BitUtils.E import util.BitUtils.*; process(bytes);

单选题Given classes defined in two different files:  1. package util;  2. public class BitUtils {  3. private static void process(byte[] b) { }  4. }  1. package app;  2. public class SomeApp {  3. public static void main(String[] args) {  4. byte[] bytes = new byte[256];  5. // insert code here  6. }  7. }  What is required at line 5 in class SomeApp to use the process method of BitUtils?()A process(bytes);B BitUtils.process(bytes);C app.BitUtils.process(bytes);D util.BitUtils.process(bytes);E import util.BitUtils. *; process(bytes);F SomeApp cannot use the process method in BitUtils.

单选题1. class super {  2. public float getNum() {return 3.0f;}  3. }  4.    5. public class Sub extends Super { 6.   7. }   Which method, placed at line 6, will cause a compiler error?()A  Public float getNum()   {return 4.0f; }B  Public void getNum ()  { }C  Public void getNum (double d)   { }D  Public double getNum (float d) {retrun 4.0f; }

多选题Given:  1.  public class ConstOver {  2.  public constOver(int x, int y, int z) {  3.  }  4.  }   Which two overload the ConstOver Constructor?()AConstOver() {}Bprotected int ConstOver(){}Cprivate ConstOver(int z, int y, byte x ) {}Dpublic Object ConstOver(Int x, int y, int z) {}Epubic void ConstOver (byte x, byte y, byte z) {}

单选题1. class Super {  2. public float getNum() { return 3.0f; }  3. }  4.   5. public class Sub extends Super {  6.   7. }  Which method, placed at line6, causes compilation to fail?()A public void getNum(){}B public void getNum(double d){}C public float getNum() { return 4.0f; }D public double getNum(float d) { return 4.0d; }

多选题public class X {  public X aMethod() { return this;}  }  public class Y extends X {  }  Which two methods can be added to the definition of class Y?()Apublic void aMethod() {}Bprivate void aMethod() {}Cpublic void aMethod(String s) {}Dprivate Y aMethod() { return null; }Epublic X aMethod() { return new Y(); }

多选题1. public class OuterClass {  2. private double d1 = 1.0;  3. // insert code here  4. }  Which two are valid if inserted at line 3?()Astatic class InnerOne { public double methoda() { return d1; } }Bstatic class InnerOne { static double methoda() { return d1; } }Cprivate class InnerOne { public double methoda() { return d1; } }Dprotected class InnerOne { static double methoda() { return d1; } }Epublic abstract class InnerOne { public abstract double methoda(); }

多选题public class OuterClass {   private double d1 1.0;   //insert code here   }   You need to insert an inner class declaration at line2. Which two inner class declarations are valid?()Astatic class InnerOne {  public double methoda() {return d1;}  }Bstatic class InnerOne {  static double methoda() {return d1;}  }Cprivate class InnerOne {  public double methoda() {return d1;}  }Dprotected class InnerOne {  static double methoda() {return d1;}  }Epublic abstract class InnerOne {  public abstract double methoda();  }

单选题1. public class ReturnIt {  2. return Type methodA(byte x, double y) {  3. return (long)x / y * 2;  4. }  5. }  What is the narrowest valid returnType for methodA in line2?()A intB byteC longD shortE floatF double

多选题1. public class Blip {  2. protected int blipvert(int x) { return 0; }  3. }  4. class Vert extends Blip {  5. // insert code here  6. }  Which five methods, inserted independently at line 5, will compile?()Apublic int blipvert(int x) { return 0; }Bprivate int blipvert(int x) { return 0; }Cprivate int blipvert(long x) { return 0; }Dprotected long blipvert(int x, int y) { return 0; }Eprotected int blipvert(long x) { return 0; }Fprotected long blipvert(long x) { return 0; }Gprotected long blipvert(int x) { return 0; }