Java软件中级工程师笔试题复杂逻辑_第1页
Java软件中级工程师笔试题复杂逻辑_第2页
Java软件中级工程师笔试题复杂逻辑_第3页
Java软件中级工程师笔试题复杂逻辑_第4页
免费预览已结束,剩余6页可下载查看

付费下载

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、页眉J2EE 部分1、运算符优先级问题,下面代码的结果是多少?(笔试)package test;public class Test public static void main(String args) int k = 0;int ret = +k + k+ + +k + k;/ ret 的值为多少2、运算符问题,下面代码分别输出什么?(笔试)package test;public class Test public static void main(String args) int i1 = 10, i2 = 10;3、下面代码的结果是什么?还是抛出异常?(笔试)package test;

2、public class Test public void myMethod(String str) public void myMethod(Object obj) public static void main(String args) Test t = new Test();t.myMethod(null);页脚页眉4、假设今天是9月 8日,下面代码输出什么?(笔试)package test;public class Test public static void main(String args) Date date = new Date();5、下面代码的输出结果是什么?packag

3、e test;public class Test public static void main(String args) double val = 11.5;6、下面代码的结果是什么?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();Overridepublic void method() class Base public void method() thr

4、ows InterruptedException 页脚页眉7、以下代码的结果是什么?package test;public class Test extends Base public static void main(String args) new Test().method();public void method() class Base 8、 true or false?package test;public class Test public static void main(String args) String str1 = new String("abc"

5、);String str2 = new String("abc");StringBuffer sb1 = new StringBuffer("abc");StringBuffer sb2 = new StringBuffer("abc");9、输出的结果是什么?package test;public class Test public static void main(String args) public int method1() int x = 1;try return x; finally +x;public int meth

6、od2() 页脚页眉int x = 1;try return x; finally return +x;这样呢?输出什么package test;public class Test public static void main(String args) public static boolean method() try return true; finally return false;10 、方法 m1 和 m2 有区别吗?什么区别package test;public class Test public static void main(String args) public sync

7、hronized void m1() public static synchronized void m2() 11 、 true or false?理由页脚页眉package test;public class Test public static void main(String args) Integer i1 = 127;Integer i2 = 127;i1 = 128;i2 = 128;12 、 true or false?理由package test;public class Test public static void main(String args) String str

8、1 = "a"String str2 = "a"String str3 = new String("a");str3 = ern();13 、 true or false?理由package test;public class Test public static void main(String args) 14 、以下代码输出是什么?页脚页眉package test;public class Test public static void main(String args) BigInteger one = new

9、 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);15 、输出的结果是什么?12345 ?根据单词排序?还是?package test;public class Test public static void main(Stri

10、ng 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();) 16 、以下代码输出的结果(笔试选择题)页脚页眉public class Test publ

11、ic static void main(String args) A. nullB. 0C. Test17 、下面为一个单例的实现代码,请指出代码中有几个错误或不合理之处,并改正。public class Test public Test instance = null;public static Test getInstance() if (instance = null) instance = new Test();return instance;18、编程输出一个目录下的所有目录及文件名称,目录之间用tab 。(笔试)19、从键盘读入 10 个整数,然后从大到小输出。 (笔试)20 、如

12、何迭代Map容器,手写个试试?答案:页脚页眉1、2、8i1 + i2 = 1010语法错误i1 * i2 = 100i1 / i2 = 13、4 、string5195、6 、12test11.0test12.07、8 、test.Testtruetest.Basefalse9、10 、1A: synchronized static是某个类的范围,2synchronized static cSync防止多个线程同false时访问这个类中的 synchronized static方法。它可以对类的所有对象实例起作用。B: synchronized 是某实例的范围,synchronized isS

13、ync()防止多个线程同时访问这个实例中的 synchronized方法。11 、12 、truetruefalsefalsetrue13 、14 、false015 、16 、twoBfiveonethreefour17 、getInstance无默认返回值instance必须是 static18 、package test;public class Test public static void main(String args) 页脚页眉new Test().read("D:/test", "");public void read(String p

14、ath, String tab) File file = new File(path);File childFiles = file.listFiles();if (childFilesi.isDirectory() read(childFilesi.getPath(), tab + "t");19 、package test;public class Test public static void main(String args) Scanner in = new Scanner(System.in);/ 注意这里的数组,不是 int 的Integer arr = ne

15、w Integer10;for (int i = 0; i < 10; i+) arri = in.nextInt();Arrays.sort(arr, new Comparator<Integer>() Overridepublic int compare(Integer o1, Integer o2) if (o1 > o2) return -1;if (o1 < o2) return 1;return 0;);20 、package test;页脚页眉public class Test public static void main(String args) Map<Class, String> m = new HashMap<Class, String>();Set<Ent

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论