- 浏览: 209657 次
- 性别:
- 来自: 厦门
-
文章分类
- 全部博客 (100)
- java设计模式学习 (1)
- javascript (2)
- sqlserver (3)
- java基础 (18)
- spring (8)
- webwork (3)
- itext (4)
- xstream (1)
- freemarker (2)
- jsp (6)
- hibernate (7)
- jquery (1)
- json (1)
- poi (2)
- iprocess (1)
- bw (1)
- bpm (0)
- java2word (0)
- ireport (1)
- Struts2.0 (13)
- webservice (6)
- j2ee基础 (7)
- jms (3)
- protocol buffer (3)
- jfreechart (1)
- spring mvc (0)
- http编程机制探析 (1)
- pb (2)
- oracle (0)
- sso (0)
- mybatis (0)
- ssl与ca认证 (0)
- cas (1)
最新评论
-
mayucai:
这个博客写的我是真服,写了一大堆,结果最后来一句这是错的。
poi获取excel和word总页数 -
iris_1992:
2005年以前,国外开原报表完全碾压国产软件,但是现在国内软件 ...
ireport与jasperreports开发总结 -
高攀sky:
...
Servlet中的八大Listener -
rmn190:
多谢, 试了N多个后, 终于参考您的内容, 设置出来了。老天开 ...
ireport与jasperreports开发总结 -
辣油_:
System.out.println("草 ...
Spring-JNDI配置
本文收录各种猥琐的Java笔试/面试题,一些比较容易忘记的,不定期更新。也希望大家在底下留言,贴出自己碰到或看到的各种猥琐笔试、面试题目。
J2EE基础部分
1、运算符优先级问题,下面代码的结果是多少?(笔试)
[java] view plaincopyprint?package test;
public class Test {
public static void main(String[] args) {
int k = 0;
int ret = ++k + k++ + ++k + k;
// ret的值为多少
System.err.println(ret);
}
}
package test;
public class Test {
public static void main(String[] args) {
int k = 0;
int ret = ++k + k++ + ++k + k;
// ret的值为多少
System.err.println(ret);
}
}2、运算符问题,下面代码分别输出什么?(笔试)
[java] view plaincopyprint?package test;
public class Test {
public static void main(String[] args) {
int i1 = 10, i2 = 10;
System.err.println("i1 + i2 = " + i1 + i2);
System.err.println("i1 - i2 = " + i1 - i2);
System.err.println("i1 * i2 = " + i1 * i2);
System.err.println("i1 / i2 = " + i1 / i2);
}
}
package test;
public class Test {
public static void main(String[] args) {
int i1 = 10, i2 = 10;
System.err.println("i1 + i2 = " + i1 + i2);
System.err.println("i1 - i2 = " + i1 - i2);
System.err.println("i1 * i2 = " + i1 * i2);
System.err.println("i1 / i2 = " + i1 / i2);
}
}3、下面代码的结果是什么?还是抛出异常?(笔试)
[java] view plaincopyprint?package test;
public class Test {
public void myMethod(String str) {
System.err.println("string");
}
public void myMethod(Object obj) {
System.err.println("object");
}
public static void main(String[] args) {
Test t = new Test();
t.myMethod(null);
}
}
package test;
public class Test {
public void myMethod(String str) {
System.err.println("string");
}
public void myMethod(Object obj) {
System.err.println("object");
}
public static void main(String[] args) {
Test t = new Test();
t.myMethod(null);
}
}
4、假设今天是9月8日,下面代码输出什么?(笔试)
[java] view plaincopyprint?package test;
import java.util.Date;
public class Test {
public static void main(String[] args) {
Date date = new Date();
System.err.println(date.getMonth() + " " + date.getDate());
}
}
package test;
import java.util.Date;
public class Test {
public static void main(String[] args) {
Date date = new Date();
System.err.println(date.getMonth() + " " + date.getDate());
}
}
5、下面代码的输出结果是什么?
[java] view plaincopyprint?package test;
public class Test {
public static void main(String[] args) {
double val = 11.5;
System.err.println(Math.round(val));
System.err.println(Math.floor(val));
System.err.println(Math.ceil(val));
}
}
package test;
public class Test {
public static void main(String[] args) {
double val = 11.5;
System.err.println(Math.round(val));
System.err.println(Math.floor(val));
System.err.println(Math.ceil(val));
}
}
6、编程输出一个目录下的所有目录及文件名称,目录之间用tab。(笔试)
[java] view plaincopyprint?package test;
import java.io.File;
public class Test {
public static void main(String[] args) {
new Test().read("D:/test", "");
}
public void read(String path, String tab) {
File file = new File(path);
File[] childFiles = file.listFiles();
for (int i = 0; childFiles != null && i < childFiles.length; i++) {
System.err.println(tab + childFiles[i].getName());
if (childFiles[i].isDirectory()) {
read(childFiles[i].getPath(), tab + "\t");
}
}
}
}
package test;
import java.io.File;
public class Test {
public static void main(String[] args) {
new Test().read("D:/test", "");
}
public void read(String path, String tab) {
File file = new File(path);
File[] childFiles = file.listFiles();
for (int i = 0; childFiles != null && i < childFiles.length; i++) {
System.err.println(tab + childFiles[i].getName());
if (childFiles[i].isDirectory()) {
read(childFiles[i].getPath(), tab + "\t");
}
}
}
}
不要觉得很简单,最起码你要记得返回当前文件夹下的所有文件的方法是listFiles(),isDirectory别拼错了。
7、从键盘读入10个整数,然后从大到小输出。(笔试)
[java] view plaincopyprint?package test;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
// 注意这里的数组,不是int的
Integer[] arr = new Integer[10];
for (int i = 0; i < 10; i++) {
arr[i] = in.nextInt();
}
Arrays.sort(arr, new Comparator<Integer>() {
@Override
public int compare(Integer o1, Integer o2) {
if (o1 > o2) return -1;
if (o1 < o2) return 1;
return 0;
}
});
System.err.println(Arrays.toString(arr));
}
}
package test;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
// 注意这里的数组,不是int的
Integer[] arr = new Integer[10];
for (int i = 0; i < 10; i++) {
arr[i] = in.nextInt();
}
Arrays.sort(arr, new Comparator<Integer>() {
@Override
public int compare(Integer o1, Integer o2) {
if (o1 > o2) return -1;
if (o1 < o2) return 1;
return 0;
}
});
System.err.println(Arrays.toString(arr));
}
}
自己手写排序算法的可以无视此题,如果是Arrays.sort()的,请注意Comparator与Comparable接口的区别,别搞混了。
8、下面代码的结果是什么?
[java] view plaincopyprint?package test;
public class Test extends Base {
public static void main(String[] args) {
Base b = new Test();
b.method();
Test t = new Test();
t.method();
}
@Override
public void method() {
System.err.println("test");
}
}
class Base {
public void method() throws InterruptedException {
System.err.println("base");
}
}
package test;
public class Test extends Base {
public static void main(String[] args) {
Base b = new Test();
b.method();
Test t = new Test();
t.method();
}
@Override
public void method() {
System.err.println("test");
}
}
class Base {
public void method() throws InterruptedException {
System.err.println("base");
}
}
9、以下代码的结果是什么?
[java] view plaincopyprint?package test;
public class Test extends Base {
public static void main(String[] args) {
new Test().method();
}
public void method() {
System.err.println(super.getClass().getName());
System.err.println(this.getClass().getSuperclass().getName());
}
}
class Base {
}
package test;
public class Test extends Base {
public static void main(String[] args) {
new Test().method();
}
public void method() {
System.err.println(super.getClass().getName());
System.err.println(this.getClass().getSuperclass().getName());
}
}
class Base {
}
10、true or false?
[java] view plaincopyprint?package test;
public class Test {
public static void main(String[] args) {
String str1 = new String("abc");
String str2 = new String("abc");
System.err.println(str1.equals(str2));
StringBuffer sb1 = new StringBuffer("abc");
StringBuffer sb2 = new StringBuffer("abc");
System.err.println(sb1.equals(sb2));
}
}
package test;
public class Test {
public static void main(String[] args) {
String str1 = new String("abc");
String str2 = new String("abc");
System.err.println(str1.equals(str2));
StringBuffer sb1 = new StringBuffer("abc");
StringBuffer sb2 = new StringBuffer("abc");
System.err.println(sb1.equals(sb2));
}
}
11、输出的结果是什么?
[java] view plaincopyprint?package test;
public class Test {
public static void main(String[] args) {
System.err.println(new Test().method1());
System.err.println(new Test().method2());
}
public int method1() {
int x = 1;
try {
return x;
} finally {
++x;
}
}
public int method2() {
int x = 1;
try {
return x;
} finally {
return ++x;
}
}
}
package test;
public class Test {
public static void main(String[] args) {
System.err.println(new Test().method1());
System.err.println(new Test().method2());
}
public int method1() {
int x = 1;
try {
return x;
} finally {
++x;
}
}
public int method2() {
int x = 1;
try {
return x;
} finally {
return ++x;
}
}
}
这样呢?输出什么
[java] view plaincopyprint?package test;
public class Test {
public static void main(String[] args) {
System.err.println(method());
}
public static boolean method() {
try {
return true;
} finally {
return false;
}
}
}
package test;
public class Test {
public static void main(String[] args) {
System.err.println(method());
}
public static boolean method() {
try {
return true;
} finally {
return false;
}
}
}
12、方法m1和m2有区别吗?什么区别
[java] view plaincopyprint?package test;
public class Test {
public static void main(String[] args) {
}
public synchronized void m1() {
}
public static synchronized void m2() {
}
}
package test;
public class Test {
public static void main(String[] args) {
}
public synchronized void m1() {
}
public static synchronized void m2() {
}
}
13、true or false?理由
[java] view plaincopyprint?package test;
public class Test {
public static void main(String[] args) {
Integer i1 = 127;
Integer i2 = 127;
System.err.println(i1 == i2);
i1 = 128;
i2 = 128;
System.err.println(i1 == i2);
}
}
package test;
public class Test {
public static void main(String[] args) {
Integer i1 = 127;
Integer i2 = 127;
System.err.println(i1 == i2);
i1 = 128;
i2 = 128;
System.err.println(i1 == i2);
}
}
14、true or false?理由
[java] view plaincopyprint?package test;
public class Test {
public static void main(String[] args) {
String str1 = "a";
String str2 = "a";
String str3 = new String("a");
System.err.println(str1 == str2);
System.err.println(str1 == str3);
str3 = str3.intern();
System.err.println(str1 == str3);
}
}
package test;
public class Test {
public static void main(String[] args) {
String str1 = "a";
String str2 = "a";
String str3 = new String("a");
System.err.println(str1 == str2);
System.err.println(str1 == str3);
str3 = str3.intern();
System.err.println(str1 == str3);
}
}
15、true or false?理由
[java] view plaincopyprint?package test;
public class Test {
public static void main(String[] args) {
System.err.println(12 - 11.9 == 0.1);
}
}
package test;
public class Test {
public static void main(String[] args) {
System.err.println(12 - 11.9 == 0.1);
}
}
16、以下代码输出是什么?
[java] view plaincopyprint?package test;
import java.math.BigInteger;
public class Test {
public static void main(String[] args) {
BigInteger one = new BigInteger("1");
BigInteger two = new BigInteger("2");
BigInteger three = new BigInteger("3");
BigInteger sum = new BigInteger("0");
sum.add(one);
sum.add(two);
sum.add(three);
System.out.println(sum.toString());
}
}
package test;
import java.math.BigInteger;
public class Test {
public static void main(String[] args) {
BigInteger one = new BigInteger("1");
BigInteger two = new BigInteger("2");
BigInteger three = new BigInteger("3");
BigInteger sum = new BigInteger("0");
sum.add(one);
sum.add(two);
sum.add(three);
System.out.println(sum.toString());
}
}
17、输出的结果是什么?12345?根据单词排序?还是?
[java] view plaincopyprint?package test;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
public class Test {
public static void main(String[] args) {
Set<String> set = new HashSet<String>();
set.add("one");
set.add("two");
set.add("three");
set.add("four");
set.add("five");
for (Iterator<String> it = set.iterator(); it.hasNext();) {
System.err.println(it.next());
}
}
}
package test;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
public class Test {
public static void main(String[] args) {
Set<String> set = new HashSet<String>();
set.add("one");
set.add("two");
set.add("three");
set.add("four");
set.add("five");
for (Iterator<String> it = set.iterator(); it.hasNext();) {
System.err.println(it.next());
}
}
}
18、如何迭代Map容器,别所大概是......,手写个试试?
19、以下代码输出的结果(笔试选择题)
[java] view plaincopyprint?public class Test {
public static void main(String[] args) {
System.err.println(args.length);
}
}
/*
A. null B. 0 C. Test
D. Exception in thread "main" java.lang.NullPointerException
*/
public class Test {
public static void main(String[] args) {
System.err.println(args.length);
}
}
/*
A. null B. 0 C. Test
D. Exception in thread "main" java.lang.NullPointerException
*/20、下面为一个单例的实现代码,请指出代码中有几个错误或不合理之处,并改正。
[java] view plaincopyprint?public class Test {
public Test instance = null;
public static Test getInstance() {
if (instance == null) {
instance = new Test();
return instance;
}
}
}
J2EE基础部分
1、运算符优先级问题,下面代码的结果是多少?(笔试)
[java] view plaincopyprint?package test;
public class Test {
public static void main(String[] args) {
int k = 0;
int ret = ++k + k++ + ++k + k;
// ret的值为多少
System.err.println(ret);
}
}
package test;
public class Test {
public static void main(String[] args) {
int k = 0;
int ret = ++k + k++ + ++k + k;
// ret的值为多少
System.err.println(ret);
}
}2、运算符问题,下面代码分别输出什么?(笔试)
[java] view plaincopyprint?package test;
public class Test {
public static void main(String[] args) {
int i1 = 10, i2 = 10;
System.err.println("i1 + i2 = " + i1 + i2);
System.err.println("i1 - i2 = " + i1 - i2);
System.err.println("i1 * i2 = " + i1 * i2);
System.err.println("i1 / i2 = " + i1 / i2);
}
}
package test;
public class Test {
public static void main(String[] args) {
int i1 = 10, i2 = 10;
System.err.println("i1 + i2 = " + i1 + i2);
System.err.println("i1 - i2 = " + i1 - i2);
System.err.println("i1 * i2 = " + i1 * i2);
System.err.println("i1 / i2 = " + i1 / i2);
}
}3、下面代码的结果是什么?还是抛出异常?(笔试)
[java] view plaincopyprint?package test;
public class Test {
public void myMethod(String str) {
System.err.println("string");
}
public void myMethod(Object obj) {
System.err.println("object");
}
public static void main(String[] args) {
Test t = new Test();
t.myMethod(null);
}
}
package test;
public class Test {
public void myMethod(String str) {
System.err.println("string");
}
public void myMethod(Object obj) {
System.err.println("object");
}
public static void main(String[] args) {
Test t = new Test();
t.myMethod(null);
}
}
4、假设今天是9月8日,下面代码输出什么?(笔试)
[java] view plaincopyprint?package test;
import java.util.Date;
public class Test {
public static void main(String[] args) {
Date date = new Date();
System.err.println(date.getMonth() + " " + date.getDate());
}
}
package test;
import java.util.Date;
public class Test {
public static void main(String[] args) {
Date date = new Date();
System.err.println(date.getMonth() + " " + date.getDate());
}
}
5、下面代码的输出结果是什么?
[java] view plaincopyprint?package test;
public class Test {
public static void main(String[] args) {
double val = 11.5;
System.err.println(Math.round(val));
System.err.println(Math.floor(val));
System.err.println(Math.ceil(val));
}
}
package test;
public class Test {
public static void main(String[] args) {
double val = 11.5;
System.err.println(Math.round(val));
System.err.println(Math.floor(val));
System.err.println(Math.ceil(val));
}
}
6、编程输出一个目录下的所有目录及文件名称,目录之间用tab。(笔试)
[java] view plaincopyprint?package test;
import java.io.File;
public class Test {
public static void main(String[] args) {
new Test().read("D:/test", "");
}
public void read(String path, String tab) {
File file = new File(path);
File[] childFiles = file.listFiles();
for (int i = 0; childFiles != null && i < childFiles.length; i++) {
System.err.println(tab + childFiles[i].getName());
if (childFiles[i].isDirectory()) {
read(childFiles[i].getPath(), tab + "\t");
}
}
}
}
package test;
import java.io.File;
public class Test {
public static void main(String[] args) {
new Test().read("D:/test", "");
}
public void read(String path, String tab) {
File file = new File(path);
File[] childFiles = file.listFiles();
for (int i = 0; childFiles != null && i < childFiles.length; i++) {
System.err.println(tab + childFiles[i].getName());
if (childFiles[i].isDirectory()) {
read(childFiles[i].getPath(), tab + "\t");
}
}
}
}
不要觉得很简单,最起码你要记得返回当前文件夹下的所有文件的方法是listFiles(),isDirectory别拼错了。
7、从键盘读入10个整数,然后从大到小输出。(笔试)
[java] view plaincopyprint?package test;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
// 注意这里的数组,不是int的
Integer[] arr = new Integer[10];
for (int i = 0; i < 10; i++) {
arr[i] = in.nextInt();
}
Arrays.sort(arr, new Comparator<Integer>() {
@Override
public int compare(Integer o1, Integer o2) {
if (o1 > o2) return -1;
if (o1 < o2) return 1;
return 0;
}
});
System.err.println(Arrays.toString(arr));
}
}
package test;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
// 注意这里的数组,不是int的
Integer[] arr = new Integer[10];
for (int i = 0; i < 10; i++) {
arr[i] = in.nextInt();
}
Arrays.sort(arr, new Comparator<Integer>() {
@Override
public int compare(Integer o1, Integer o2) {
if (o1 > o2) return -1;
if (o1 < o2) return 1;
return 0;
}
});
System.err.println(Arrays.toString(arr));
}
}
自己手写排序算法的可以无视此题,如果是Arrays.sort()的,请注意Comparator与Comparable接口的区别,别搞混了。
8、下面代码的结果是什么?
[java] view plaincopyprint?package test;
public class Test extends Base {
public static void main(String[] args) {
Base b = new Test();
b.method();
Test t = new Test();
t.method();
}
@Override
public void method() {
System.err.println("test");
}
}
class Base {
public void method() throws InterruptedException {
System.err.println("base");
}
}
package test;
public class Test extends Base {
public static void main(String[] args) {
Base b = new Test();
b.method();
Test t = new Test();
t.method();
}
@Override
public void method() {
System.err.println("test");
}
}
class Base {
public void method() throws InterruptedException {
System.err.println("base");
}
}
9、以下代码的结果是什么?
[java] view plaincopyprint?package test;
public class Test extends Base {
public static void main(String[] args) {
new Test().method();
}
public void method() {
System.err.println(super.getClass().getName());
System.err.println(this.getClass().getSuperclass().getName());
}
}
class Base {
}
package test;
public class Test extends Base {
public static void main(String[] args) {
new Test().method();
}
public void method() {
System.err.println(super.getClass().getName());
System.err.println(this.getClass().getSuperclass().getName());
}
}
class Base {
}
10、true or false?
[java] view plaincopyprint?package test;
public class Test {
public static void main(String[] args) {
String str1 = new String("abc");
String str2 = new String("abc");
System.err.println(str1.equals(str2));
StringBuffer sb1 = new StringBuffer("abc");
StringBuffer sb2 = new StringBuffer("abc");
System.err.println(sb1.equals(sb2));
}
}
package test;
public class Test {
public static void main(String[] args) {
String str1 = new String("abc");
String str2 = new String("abc");
System.err.println(str1.equals(str2));
StringBuffer sb1 = new StringBuffer("abc");
StringBuffer sb2 = new StringBuffer("abc");
System.err.println(sb1.equals(sb2));
}
}
11、输出的结果是什么?
[java] view plaincopyprint?package test;
public class Test {
public static void main(String[] args) {
System.err.println(new Test().method1());
System.err.println(new Test().method2());
}
public int method1() {
int x = 1;
try {
return x;
} finally {
++x;
}
}
public int method2() {
int x = 1;
try {
return x;
} finally {
return ++x;
}
}
}
package test;
public class Test {
public static void main(String[] args) {
System.err.println(new Test().method1());
System.err.println(new Test().method2());
}
public int method1() {
int x = 1;
try {
return x;
} finally {
++x;
}
}
public int method2() {
int x = 1;
try {
return x;
} finally {
return ++x;
}
}
}
这样呢?输出什么
[java] view plaincopyprint?package test;
public class Test {
public static void main(String[] args) {
System.err.println(method());
}
public static boolean method() {
try {
return true;
} finally {
return false;
}
}
}
package test;
public class Test {
public static void main(String[] args) {
System.err.println(method());
}
public static boolean method() {
try {
return true;
} finally {
return false;
}
}
}
12、方法m1和m2有区别吗?什么区别
[java] view plaincopyprint?package test;
public class Test {
public static void main(String[] args) {
}
public synchronized void m1() {
}
public static synchronized void m2() {
}
}
package test;
public class Test {
public static void main(String[] args) {
}
public synchronized void m1() {
}
public static synchronized void m2() {
}
}
13、true or false?理由
[java] view plaincopyprint?package test;
public class Test {
public static void main(String[] args) {
Integer i1 = 127;
Integer i2 = 127;
System.err.println(i1 == i2);
i1 = 128;
i2 = 128;
System.err.println(i1 == i2);
}
}
package test;
public class Test {
public static void main(String[] args) {
Integer i1 = 127;
Integer i2 = 127;
System.err.println(i1 == i2);
i1 = 128;
i2 = 128;
System.err.println(i1 == i2);
}
}
14、true or false?理由
[java] view plaincopyprint?package test;
public class Test {
public static void main(String[] args) {
String str1 = "a";
String str2 = "a";
String str3 = new String("a");
System.err.println(str1 == str2);
System.err.println(str1 == str3);
str3 = str3.intern();
System.err.println(str1 == str3);
}
}
package test;
public class Test {
public static void main(String[] args) {
String str1 = "a";
String str2 = "a";
String str3 = new String("a");
System.err.println(str1 == str2);
System.err.println(str1 == str3);
str3 = str3.intern();
System.err.println(str1 == str3);
}
}
15、true or false?理由
[java] view plaincopyprint?package test;
public class Test {
public static void main(String[] args) {
System.err.println(12 - 11.9 == 0.1);
}
}
package test;
public class Test {
public static void main(String[] args) {
System.err.println(12 - 11.9 == 0.1);
}
}
16、以下代码输出是什么?
[java] view plaincopyprint?package test;
import java.math.BigInteger;
public class Test {
public static void main(String[] args) {
BigInteger one = new BigInteger("1");
BigInteger two = new BigInteger("2");
BigInteger three = new BigInteger("3");
BigInteger sum = new BigInteger("0");
sum.add(one);
sum.add(two);
sum.add(three);
System.out.println(sum.toString());
}
}
package test;
import java.math.BigInteger;
public class Test {
public static void main(String[] args) {
BigInteger one = new BigInteger("1");
BigInteger two = new BigInteger("2");
BigInteger three = new BigInteger("3");
BigInteger sum = new BigInteger("0");
sum.add(one);
sum.add(two);
sum.add(three);
System.out.println(sum.toString());
}
}
17、输出的结果是什么?12345?根据单词排序?还是?
[java] view plaincopyprint?package test;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
public class Test {
public static void main(String[] args) {
Set<String> set = new HashSet<String>();
set.add("one");
set.add("two");
set.add("three");
set.add("four");
set.add("five");
for (Iterator<String> it = set.iterator(); it.hasNext();) {
System.err.println(it.next());
}
}
}
package test;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
public class Test {
public static void main(String[] args) {
Set<String> set = new HashSet<String>();
set.add("one");
set.add("two");
set.add("three");
set.add("four");
set.add("five");
for (Iterator<String> it = set.iterator(); it.hasNext();) {
System.err.println(it.next());
}
}
}
18、如何迭代Map容器,别所大概是......,手写个试试?
19、以下代码输出的结果(笔试选择题)
[java] view plaincopyprint?public class Test {
public static void main(String[] args) {
System.err.println(args.length);
}
}
/*
A. null B. 0 C. Test
D. Exception in thread "main" java.lang.NullPointerException
*/
public class Test {
public static void main(String[] args) {
System.err.println(args.length);
}
}
/*
A. null B. 0 C. Test
D. Exception in thread "main" java.lang.NullPointerException
*/20、下面为一个单例的实现代码,请指出代码中有几个错误或不合理之处,并改正。
[java] view plaincopyprint?public class Test {
public Test instance = null;
public static Test getInstance() {
if (instance == null) {
instance = new Test();
return instance;
}
}
}
发表评论
-
线程池的原理及实现
2014-04-16 11:21 5841、线程池简介: 多线程技术主要解决处理器单元内多个线 ... -
java线程安全总结
2014-02-27 16:56 605关于java线程安全,网上有很多资料,我只想从自己的角度总结对 ... -
Java内存溢出的详细解决方案
2013-03-26 10:50 0一、内存溢出类型 1、j ... -
内存分区
2013-03-26 10:12 0Java代码 内存可分为3个区:堆(heap)、栈(sta ... -
持续集成工具hudson(Continuous Integration )CI
2013-03-20 13:19 983一.什么是持续集成 持 ... -
what is difference between hashmap and hashtable
2013-02-28 14:31 01.Hashmap is unSynchronized and ... -
java引用类型和值类型
2012-07-27 13:58 974Java传值还是传引用终极解释,还是看老外解释的清楚啊。 ... -
在Java中gsm modem发短信
2011-11-13 17:21 0JAVA发送SMS短信有两种方法:一是通过运营商的网关;二是通 ... -
java枚举类型
2011-10-27 11:00 1010枚举类型是JDK5.0的新特征。Sun引进了一个全新的关键字e ... -
JDK1.5新特性介绍
2011-10-27 10:51 734“JDK1.5”(开发代号猛 ... -
java中的enum类型与单态设计模式
2011-10-27 10:40 830单态设计模式有三种做法: 1.声明公有实例为public 2. ... -
谨慎地实现Serializable
2011-10-27 10:15 1183《Effective Java中文版( ... -
Java中static、final用法小结
2011-04-12 15:24 995一、final 1.final变量: ... -
j2se代码性能技巧
2011-03-04 17:00 0.JAVA开发工具集(JDK) ... -
Map与List性能比较
2011-03-04 16:23 103531.Collection接口与Map的总体框架图 Colle ... -
String.format方法使用
2011-03-04 11:45 9667一.常规类型、字符类型和数值类型的格式说明符的语法如下:%[ ... -
HttpServletResponseWrapper获取jsp的输出内容
2011-02-17 10:17 0主题:(转)用HttpServletResponseWrapp ... -
java hotswap(java热部署)
2011-01-04 14:33 2070安装步骤: 1、 在 windows 启动安装程序,在控制 ... -
common-BeanUtils使用
2010-12-17 15:16 14761。在審核過程中,我們 ... -
java压缩加密
2010-12-06 12:03 37101。首先下载winzipaes.jar(h ...
相关推荐
{没工作经验的人找C、C++、Java、软件测试方面的工作要看的题,跳槽的也可以看下,都是笔试中...Java笔试题.rar 软件测试.rar 高质量C /C编程指南.rar 最新的是C、C 、Java及软件测试的笔试、面试题集合Version3
描述中的“某公司笔试题java&.net全集收录,包括一套Java笔试题和一套。net笔试题,含答案!”说明这份资料包含了两套完整的笔试题目,分别针对Java和.NET平台,而且每套题目都有对应的答案,这对于准备面试或自我...
本书收录了大量来自实际招聘过程中的经典题目,并提供了详尽的解答和解析,旨在帮助读者全面掌握Java编程的核心技能,提高解决问题的能力。 #### 二、Java基础知识 1. **Java语言特性** - 面向对象:封装、继承、...
在Version2、Version1基础上修改、增加了一点题; 没工作经验的人找C、C++、Java、软件测试方面的工作要看的题,跳槽的也可以看下...Java笔试题.rar; 软件测试.rar ; 高质量C++/C编程指南.rar; SQL语法手册.rar; unix
本压缩包文件"各软件公司笔试面试题整理"收录了多家知名企业的笔试题目,为准备应聘者提供了宝贵的参考资料。以下是基于这个主题的详细知识点讲解: 1. **Java基础**: - 数据类型:Java有八种基本数据类型,包括...
* 看"嵌入式经典面试题目收录" 常见面试题目 * 必须每道题目都能流畅完整打出来 * 准备自我介绍:教育背景、工作背景、培训背景 * 技术问答:对面试官所提出的技术问题,进行解答 * 解答问题要简洁明了,要用肯定...
- 预习面试题:“嵌入式经典面试题目收录”,确保能流畅回答。 - 自我介绍:包括教育背景、工作背景、培训背景和技术问答。 - 技术问答:简洁、肯定的回答,对未知问题坦诚表示不知,展现学习态度。 5. **面试...
这一章节主要收录了近年来海信在线测评的相关经验和题目分享,这对于准备应聘海信的同学来说是非常宝贵的资源。例如: **2.1 海信2015网上测评--财务培训生** - **测评形式**:一般包含逻辑推理、数学运算、案例...
这里收录的资料比我刚才的更全,里面除了面试技巧外,有很多专业的笔试题目,可以帮助大家,希望大家早日找到属于自己的好工作!!
这篇文档“部分外企笔试真题总结”是一个PDF文件,主要收录了来自知名IT外企如微软、IBM、英特尔等公司的笔试题目。虽然其中的部分题目可能年代较久,且有可能在其他地方出现过,但这份资料对于有志于进入这些企业...
总结Java面试题之选择题部分,包含【Java]、【数据库】、【框架】、【[Redis]、[Linux】等,包含题目讲解和考点提示,收录公司常考笔试题,收集不易,建议收藏,博文同步PDF文档
这份资料总结了多家知名企业在招聘Java开发人员时常用的面试和笔试题目,对于准备面试的求职者来说是非常有用的参考资料。 #### 十四、经典java小程序源代码打包合集 这份资料集合了多个实用的小程序源代码,包括...
Java简答题总结pdf文档是面试题的总结,涵盖了Java、数据库、框架、Redis、Linux等方面的知识点,包含题目讲解和考点提示,收录了公司常考笔试题,建议收藏。 第1题:数据库范式 数据库范式是设计表结构的规则,...
总所周知,不论你是面试Java/C++/C...的岗位,算法是鉴定一个人基础的重要指标,良好的算法基础也是你能通过笔试的必要条件。剑指Offer是众多企业历年招聘的经典题目,刷上几遍剑指Offer,是你临阵磨枪的最好选择。 ...