掌上明珠Java程序员面试总结
2023-06-29
1. 分配一个5列6行的字符串数组.
2. 写出下面这段程序的输出
try
int i=0;
int i2=3/i;
catch(ArithmeticException ae)
System.out.println(“数学计算错误”);
catch(Exception e)
System.out.println(“通用错误”);
finally
System.out.println(“计算完成”);
3. 我们希望下面这段程序能顺序打出0到9十个数字,请指出错误:
public class Demo
ArralList queue=new ArrayList();
int nextID=0;
Object lock=new Object();
public static void main(String[] args)
new Demo().start();
public void start()
new Producer().start();
new Producer().start();
new Consumer().start();
new Consumer().start();
class Producer implements Runnable
public void run()
while(nextID