200+ câu trắc nghiệm Lập trình Java cơ sở có đáp án - Phần 1

Đọc đoạn code sau:1:public class Test {2:public int aMethod() {3:int i = 0;4:i++;5:return i;6:}7:public static void main (String[]args){8:Test test = new Test();9:test.aMethod();10:int j = te

22/30

Đọc đoạn code sau:

1:public class Test {

2:public int aMethod() {

3:int i = 0;

4:i++;

5:return i;

6:}

7:public static void main (String[]args){

8:Test test = new Test();

9:test.aMethod();

10:int j = test.aMethod();

11:System.out.println(j);

12:}

13:}

Kết quả là gì?

0

1

2

Lỗi biên dịch

Giải thích

Chọn đáp án B