执行下列程序段后a和b的值为 class AB{ int a , b ; public void init(int x){ a = x ; int b = 5 ; } public void display(){ System.out.println("a = "+a+" b = "+b); } } public class ABTest{ public static void main(String[] args){ AB ab = new AB(); ab.init(6); ab.display() ; } } A: a = 5 b = 5 B: a = 0 b = 0 C: a = 6 b = 5 D: a = 6 b = 0
执行下列程序段后a和b的值为 class AB{ int a , b ; public void init(int x){ a = x ; int b = 5 ; } public void display(){ System.out.println("a = "+a+" b = "+b); } } public class ABTest{ public static void main(String[] args){ AB ab = new AB(); ab.init(6); ab.display() ; } } A: a = 5 b = 5 B: a = 0 b = 0 C: a = 6 b = 5 D: a = 6 b = 0
1