收藏 分销(赏)

java软件中级工程师笔试题复杂逻辑.doc

上传人:精**** 文档编号:2492457 上传时间:2024-05-30 格式:DOC 页数:8 大小:41.04KB
下载 相关 举报
java软件中级工程师笔试题复杂逻辑.doc_第1页
第1页 / 共8页
java软件中级工程师笔试题复杂逻辑.doc_第2页
第2页 / 共8页
java软件中级工程师笔试题复杂逻辑.doc_第3页
第3页 / 共8页
java软件中级工程师笔试题复杂逻辑.doc_第4页
第4页 / 共8页
java软件中级工程师笔试题复杂逻辑.doc_第5页
第5页 / 共8页
点击查看更多>>
资源描述

1、(完整版)java软件中级工程师笔试题复杂逻辑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、下面代码的结果是什么?还是抛出

2、异常?(笔试) package test;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、下面

3、代码的输出结果是什么? package 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

4、 void method() throws 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(”

5、abc”);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 method2() int x = 1;try return x

6、; 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 synchronized void m1() public static s

7、ynchronized 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 str1 = a;String str2 = ”a”;String str3 = ne

8、w String(a);str3 = str3。intern();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 BigInteger(1);BigInteger two = new BigInteger(2);BigInteger three = new BigI

9、nteger(”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(String args) SetString set = new HashSetString();set.add(one);set.add(two);set.add(”three);set。add(four);set。add(”five);for (Ite

10、rator it = set.iterator(); it.hasNext();) 16、以下代码输出的结果(笔试选择题)public class Test public 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

11、 instance;18、编程输出一个目录下的所有目录及文件名称,目录之间用tab。(笔试) 19、从键盘读入10个整数,然后从大到小输出。(笔试)20、如何迭代Map容器,手写个试试?答案:1、82、i1 + i2 = 1010语法错误i1 i2 = 100i1 / i2 = 13、string4、5 195、1211。012。06、testtest7、test.Testtest.Base8、truefalse9、12false10、A: synchronized static是某个类的范围,synchronized static cSync防止多个线程同时访问这个类中的synchroniz

12、ed static 方法。它可以对类的所有对象实例起作用。??B: synchronized 是某实例的范围,synchronized isSync()防止多个线程同时访问这个实例中的synchronized 方法。11、truefalse12、truefalsetrue13、false14、015、twofiveonethreefour16、B17、getInstance 无默认返回值instance?必须是static18、package test;public class Test public static void main(String args) new Test()。read(

13、”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+) if (childFilesi。isDirectory()) read(childFilesi。getPath(), tab + t);19、package test;public class Test public static void

14、main(String args) Scanner in = new Scanner(System.in);/ 注意这里的数组,不是int的Integer arr = new Integer10;for (int i = 0; i () 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) MapClass, String m = new HashMapClass, String();Set set = m。entrySet();IteratorEntryClass, String it = set。iterator();while (it。hasNext()) Map.EntryClass, String entry = it。next();Class key = entry.getKey();String value = entry.getValue();

展开阅读全文
相似文档                                   自信AI助手自信AI助手
猜你喜欢                                   自信AI导航自信AI导航
搜索标签

当前位置:首页 > 通信科技 > 开发语言

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        获赠5币

©2010-2024 宁波自信网络信息技术有限公司  版权所有

客服电话:4008-655-100  投诉/维权电话:4009-655-100

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :gzh.png    weibo.png    LOFTER.png 

客服