(线程的同步)为了支持压栈线程与弹栈线程之间的交互与同步,在程序的下画线处依次填入的语句是________。public class IntStack{ private int idx=0; private int[] data =new int[8]; public ______ void push(int i){ data[idx]= i; idx++; _______ } .......}
举一反三
- 分析程序,将代码补充完整class A { private int x; public A(int i) { x = i; } } class B extends A { private int y; public B(int i) { ___________ ____; y = i; } }
- 在下面的类中,合法重载的方法是( ) public class Q1{ public void method(int i){} } A: private void method(int i){} B: public void method(int k){} C: public int method(int i){} D: private float method(float f){}
- 在下列程序的划线处应填入的语句是class Person { private int a;}public class Man extends Person{ public int b; public static void main (String arg []){ Person p=new Person(); Man t=new Man(); int i: }} A.i=w; B.i=b C.i=p.a; D.i=t.b;
- class Person {private int a;public int change(int m){ return m; }}public class Teacher extends Person {public int b;public static void main(String arg[]){Person p = new Person();Teacher t = new Teacher();int i;// point x}}在 // point x安排哪个语句合法?
- public class TestDemo{ private int x = 2; static int y = 3; public void method(){ final int i=100; int j = 10; class Cinner{ public void mymethod(){ //Here } } } } 在Here处可以访问的变量是哪些?() A: x B: y C: i D: j