栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > Java面试题

掌上明珠面试总结

Java面试题 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

掌上明珠面试总结

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<10){queue.add(new Integer(nextID++));synchronized(lock){try{lock.notifyAll();}catch(Exception e){}}try{Thread.sleep(1000);}catch(InterruptedException e){}}}}class Consumer implements Runnable{public void run(){while(true){if(queue.size()==0){synchronized(lock){try{lock.wait();}catch(Exception e){}}}System.out.println(queue.remove(0));}}}}4.完成下面的程序,把一个int值保存到byte数组中(高位在前).int i=13223;byte[] b=new byte[4];5.请说明Map(映射表)和Set(集合)这两种数据结构的异同点.6.有一个GBK编码的文本文件c:/a.txt(<32k),请写出一段程序,读取它的内容显示在标准输出上.7.请完成下面的排序算法public interface Comparable{//Compare to another instance//@return >0 if this is larger,=0 if equal, <0 if this is smaller.public int compareTo(Object o);}public static void sort(Comparable[] arr){…………}

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/264631.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号