Java面试题
来源:互联网 发布:mac声音灰色 编辑:程序博客网 时间:2024/06/05 05:05
1
public static void main(String[] args)
{
String s;
System.out.println(s);
}
init:
deps-jar:
Compiling 1 source file to D:/test/Test/build/classes
D:/test/Test/src/test/test.java:57: 可能尚未初始化变量 s
System.out.println(s);
1 错误
2
public static void main(String[] args)
{
int[] a = new int[5];
System.out.println(a[1]);
}
init:
deps-jar:
Compiling 1 source file to D:/test/Test/build/classes
compile-single:
run-single:
0
生成成功(总时间:0 秒)
3
/*
* test.java
*
* Created on 2008年2月27日, 下午9:47
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package test;
/**
*
* @author rulinma
*/
public class test {
static int i = 0;
/** Creates a new instance of test */
public test() {
}
public static int foo(int i)
{
try
{
if(i==1)
{
i = i / 0 ;
}
else
{
i=i+1;
}
}
catch(Exception ex)
{
i = i+2;
ex.getMessage();
return i;
}
finally
{
i = i + 4;
System.out.println(i);
}
i= i+5;
return i;
}
public static void main(String[] args)
{
foo(0);
foo(1);
System.out.println(i);
}
}
init:
deps-jar:
Compiling 1 source file to D:/test/Test/build/classes
compile-single:
run-single:
5
7
0
生成成功(总时间:0 秒)
4
public static void main(String[] args)
{
String a[] = new String[1];
try
{
System.out.println(a[3]);
}
catch(ArrayIndexOutOfBoundsException ex)
{
System.out.println(ex.toString());
}
catch(Exception e)
{
System.out.println(e.toString());
}
}
init:
deps-jar:
compile-single:
run-single:
java.lang.ArrayIndexOutOfBoundsException: 3
生成成功(总时间:0 秒)
- Java面试题-朋友的面试题
- java 阿里面试题 百度面试题 CVTE面试题
- Java面试题集
- JAVA面试题
- Java面试题集
- Java 面试题
- JAVA面试题集
- java面试题1
- JAVA华为面试题
- java常用面试题
- java面试题
- JAVA面试题集
- JAVA面试题集
- java面试题集
- [转载] JAVA面试题
- Java面试题集
- JAVA面试题-1
- [转载] JAVA面试题
- windows2003下access只能读,不能写
- AXIS java heap 回收方式
- Spring Integration DWR
- 关于一个用VC做的系统
- 15个步骤收获一生的学习习惯
- Java面试题
- Beginning 创建之初
- Blacklist polluting products
- 删除数据表中的重复数据
- 别人学钢琴的感受
- web.xml文件中定义和映射Servlet(2/3)
- ZZ-Windows消息参考
- 用P3P header解决iframe跨域访问cookie
- 关于统一风格