9-JAVA英文面试题

9-JAVA英文面试题


2024年4月2日发(作者:)

QUESTION 1 Which two create an InputStream and open file the "" for reading?

(Choose Two)

A. InputStream in=new FileReader("");

B. InputStream in=new FileInputStream("");

C. InputStream in=new InputStreamFileReader ("", "read");

D. FileInputStream in=new FileReader(new File(""));

E. FileInputStream in=new FileInputStream(new File(""));

QUESTION 2 Which two construct an Outputstream that appends to the file ""?

(Choose Two)

?A. OutputStream out=new FileOutputStream("");

B. OutputStream out=new FileOutputStream("", "append");

C. FileOutputStream out=new FileOutputStream("", true);

D. FileOutputStream out=new FileOutputStream(new file(""));

E. OutputStream out=new FileOutputStream(new File(""),true);

QUESTION 3 Which constructs a BufferedInputStream?

A. New BufferedInputStream("");

B. New BufferedInputStream(new File(""));

C. New BufferedInputStream(new Writer(""));

D. New BufferedInputStream(new Writer(""));

E. New BufferedInputStream(new InputStream(""));

F. New BufferedInputStream(new FileInputStream(""));

QUESTION 4 Which is a valid identifier?

A. false

B. default

C. _object

D. a-class

QUESTION 5 Given:

1. public class Test {

2. public static void main (String[]args) {

3. String foo = args[1];

4. String bar = args[2];

5. String baz = args[3];

6. n("baz = " + baz);

7. }

8. }

And the output:

baz = 2

Which command line invocation will produce the output?

A. Java Test 2222

B. Java Test 1 2 3 4

C. Java Test 4 2 4 2

D. Java Test 4 3 2 1

QUESTION 6 Given:

8. int index = 1;

9. String [] test = new String[3];

10. String foo = test[index];

What is the result?

A. Foo has the value ""

B. Foo has the value null

C. An exception is thrown

D. The code will not compile

QUESTION 7 Given:

1. public interface Foo{

2. int k = 4;

3. }

Which three are equivalent to line 2? (Choose Three) equivalent 同等的,相同的

A. final int k = 4;

B. public int k = 4;

C. static int k = 4;

D. private int k = 4;

E. abstract int k = 4;

F. volatile int k = 4;

G. transient int k = 4;

H. protected int k = 4;

QUESTION 8 Given: 注意:s是static变量,默认赋初值为null

1. public class foo {

2. static String s;

3. public static void main (String[]args) {

4. n ("s=" + s);

5. }

6. }

What is the result?

A. The code compiles and "s=" is printed.

B. The code compiles and "s=null" is printed.

C. The code does not compile because string s is not initialized.

D. The code does not compile because string s cannot be referenced.

E. The code compiles, but a NullPointerException is thrown when toString is called.

QUESTION 9 Exhibit:

1. public class X {

2. public static void main (String[]args) {


发布者:admin,转转请注明出处:http://www.yc00.com/news/1712042987a1995601.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信