单选题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 = 

题目
单选题
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.


相似考题
更多“单选题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 = ”相关问题
  • 第1题:

    1. public interface A {  2. public void doSomething(String thing);  3. }  1. public class AImpl implements A {  2. public void doSomething(String msg) { }  3. }  1. public class B {  2. public A doit() {  3. // more code here  4. }  5.  6. public String execute() { 7. // more code here  8. }  9. }  1. public class C extends B {  2. public AImpl doit() {  3. // more code here  4. }  5.  6. public Object execute() {  7. // more code here  8. }  9. }  Which statement is true about the classes and interfaces in the exhibit?() 

    • A、 Compilation will succeed for all classes and interfaces.
    • B、 Compilation of class C will fail because of an error in line 2.
    • C、 Compilation of class C will fail because of an error in line 6.
    • D、 Compilation of class AImpl will fail because of an error in line 2.

    正确答案:C

  • 第2题:

    1. public class Test {   2. public static void main (String args) {   3. unsigned byte b = 0;   4. b--;   5.   6. }   7. }   What is the value of b at line 5?()  

    • A、 -1
    • B、 255
    • C、 127
    • D、 Compilation will fail.
    • E、 Compilation will succeed but the program will throw an exception at line 4.

    正确答案:D

  • 第3题:

    现有2 个文件:  1. package x;  2. public class X {  3. public static void doX() { System.out.print("doX "); }  4. }  和:  1. class Find {  2. public static void main(String [] args) {  3. //insert code here  4. }  5. }  哪两行分别插入到类Find 的第3 行将编译并产生输出“doX”? ()

    • A、doX();
    • B、X.doX();
    • C、x.X.doX();
    • D、x.X myX = new x.X(); myX.doX();

    正确答案:C,D

  • 第4题:

    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) {}

    正确答案:A,C

  • 第5题:

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

    正确答案:C

  • 第6题:

    Given a class Repetition:  1. package utils;  2.  3. public class Repetition {  4. public static String twice(String s) { return s + s; }  5. }  and given another class Demo:  1. // insert code here 2.  3. public class Demo {  4. public static void main(String[] args) {  5. System.out.println(twice(”pizza”));  6. }  7. }  Which code should be inserted at line 1 of Demo.java to compile and run Demo to print“pizzapizza”?() 

    • A、 import utils.*;
    • B、 static import utils.*;
    • C、 import utils.Repetition.*;
    • D、 static import utils.Repetition. *;
    • E、 import utils.Repetition.twice();
    • F、 import static utils.Repetition.twice;
    • G、 static import utils.Repetition.twice;

    正确答案:F

  • 第7题:

    单选题
    1. public class Test {   2. public static void main (String args) {   3. unsigned byte b = 0;   4. b--;   5.   6. }   7. }   What is the value of b at line 5?()
    A

     -1

    B

     255

    C

     127

    D

     Compilation will fail.

    E

     Compilation will succeed but the program will throw an exception at line 4.


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

  • 第8题:

    单选题
    Given classes defined in two different files: 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.


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

  • 第9题:

    多选题
    现有2 个文件:  1. package x;  2. public class X {  3. public static void doX() { System.out.print("doX "); }  4. }  和:  1. class Find {  2. public static void main(String [] args) {  3. //insert code here  4. }  5. }  哪两行分别插入到类Find 的第3 行将编译并产生输出“doX”? ()
    A

    doX();

    B

    X.doX();

    C

    x.X.doX();

    D

    x.X myX = new x.X(); myX.doX();


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

  • 第10题:

    单选题
    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);


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

  • 第11题:

    单选题
    Given a class Repetition:  1. package utils;  2.  3. public class Repetition {  4. public static String twice(String s) { return s + s; }  5. }  and given another class Demo:  1. // insert code here 2.  3. public class Demo {  4. public static void main(String[] args) {  5. System.out.println(twice(”pizza”));  6. }  7. }  Which code should be inserted at line 1 of Demo.java to compile and run Demo to print“pizzapizza”?()
    A

     import utils.*;

    B

     static import utils.*;

    C

     import utils.Repetition.*;

    D

     static import utils.Repetition. *;

    E

     import utils.Repetition.twice();

    F

     import static utils.Repetition.twice;

    G

     static import utils.Repetition.twice;


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

  • 第12题:

    单选题
    1. public class A {  2. void A() {  3. System.out.println(“Class A”);  4. }  5. public static void main(String[] args) {  6. new A();  7. }  8. }  What is the result?()
    A

     Class A

    B

     Compilation fails.

    C

     An exception is thrown at line 2.

    D

     An exception is thrown at line 6.

    E

     The code executes with no output.


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

  • 第13题:

    Which declarations will allow a class to be started as a standalone program?()  

    • A、public void main(String args[])
    • B、public void static main(String args[])
    • C、public static main(String[] argv)
    • D、final public static void main(String [] array)
    • E、public static void main(String args[])

    正确答案:D,E

  • 第14题:

    1. public class A {  2. void A() {  3. System.out.println(“Class A”);  4. }  5. public static void main(String[] args) {  6. new A();  7. }  8. }  What is the result?()  

    • A、 Class A
    • B、 Compilation fails.
    • C、 An exception is thrown at line 2.
    • D、 An exception is thrown at line 6.
    • E、 The code executes with no output.

    正确答案:E

  • 第15题:

    ClassOne.java: 1. package com.abe.pkg1; 2. public class ClassOne { 3. private char var = ‘a’; 4. char getVar() { return var; } 5. } ClassTest.java: 1. package com.abe.pkg2; 2. import com.abc.pkg1.ClassOne; 3. public class ClassTest extends ClassOne { 4. public static void main(String[] args) { 5. char a = new ClassOne().getVar();6. char b = new ClassTest().getVar(); 7. } 8. } What is the result?()

    • A、 Compilation fails.
    • B、 Compilation succeeds and no exceptions are thrown.
    • C、 An exception is thrown at line 5 in ClassTest.java.
    • D、 An exception is thrown at line 6 in ClassTest.java.

    正确答案:A

  • 第16题:

    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.

    正确答案:F

  • 第17题:

    ClassOne.java  1. package com.abc.pkg1;  2. public class ClassOne {  3. private char var = ‘a’;   4. char getVar()  {return var;}  5. }  ClassTest.java    1. package com.abc.pkg2;  2. import com.abc.pkg1.ClassOne;  3. public class ClassTest extends ClassOne {  4.   public static void main(String[]args)  {  5.     char a = new ClassOne().getVar();  6.     char b = new ClassTest().getVar();   7.   }  8. }      What is the result?()  

    • A、 Compilation will fail.
    • B、 Compilation succeeds and no exceptions are thrown.
    • C、 Compilation succeeds but an exception is thrown at line 5 in ClassTest.java.
    • D、 Compilation succeeds but an exception is thrown at line 6 in ClassTest.java.

    正确答案:B

  • 第18题:

    单选题
    1. public interface A {  2. public void doSomething(String thing);  3. }  1. public class AImpl implements A {  2. public void doSomething(String msg) { }  3. }  1. public class B {  2. public A doit() {  3. // more code here  4. }  5.  6. public String execute() { 7. // more code here  8. }  9. }  1. public class C extends B {  2. public AImpl doit() {  3. // more code here  4. }  5.  6. public Object execute() {  7. // more code here  8. }  9. }  Which statement is true about the classes and interfaces in the exhibit?()
    A

     Compilation will succeed for all classes and interfaces.

    B

     Compilation of class C will fail because of an error in line 2.

    C

     Compilation of class C will fail because of an error in line 6.

    D

     Compilation of class AImpl will fail because of an error in line 2.


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

  • 第19题:

    单选题
    Given classes defined in two different files: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);


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

  • 第20题:

    单选题
    ClassOne.java  1. package com.abc.pkg1;  2. public class ClassOne {  3. private char var = ‘a’;   4. char getVar()  {return var;}  5. }  ClassTest.java    1. package com.abc.pkg2;  2. import com.abc.pkg1.ClassOne;  3. public class ClassTest extends ClassOne {  4.   public static void main(String[]args)  {  5.     char a = new ClassOne().getVar();  6.     char b = new ClassTest().getVar();   7.   }  8. }      What is the result?()
    A

     Compilation will fail.

    B

     Compilation succeeds and no exceptions are thrown.

    C

     Compilation succeeds but an exception is thrown at line 5 in ClassTest.java.

    D

     Compilation succeeds but an exception is thrown at line 6 in ClassTest.java.


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

  • 第21题:

    单选题
    ClassOne.java: 1. package com.abe.pkg1; 2. public class ClassOne { 3. private char var = ‘a’; 4. char getVar() { return var; } 5. } ClassTest.java: 1. package com.abe.pkg2; 2. import com.abc.pkg1.ClassOne; 3. public class ClassTest extends ClassOne { 4. public static void main(String[] args) { 5. char a = new ClassOne().getVar();6. char b = new ClassTest().getVar(); 7. } 8. } What is the result?()
    A

     Compilation fails.

    B

     Compilation succeeds and no exceptions are thrown.

    C

     An exception is thrown at line 5 in ClassTest.java.

    D

     An exception is thrown at line 6 in ClassTest.java.


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

  • 第22题:

    单选题
    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=newbyte[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

    importutil.BitUtils.*;process(bytes);

    F

    SomeApp cannot use the process method in BitUtils.


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

  • 第23题:

    单选题
    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;


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