Java软件中级工程师笔试题复杂逻辑Word文档下载推荐.docx
《Java软件中级工程师笔试题复杂逻辑Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《Java软件中级工程师笔试题复杂逻辑Word文档下载推荐.docx(11页珍藏版)》请在冰点文库上搜索。
publicvoidmyMethod(Stringstr){
publicvoidmyMethod(Objectobj){
Testt=newTest();
t.myMethod(null);
8日,下面代码输出什么?
(笔试)月、假设今天是49packagetest;
Datedate=newDate();
5、下面代码的输出结果是什么?
packagetest;
doubleval=11.5;
、下面代码的结果是什么?
6packagetest;
publicclassTestextendsBase{
Baseb=newTest();
b.method();
t.method();
@Override
publicvoidmethod(){
classBase{
publicvoidmethod()throwsInterruptedException{
、以下代码的结果是什么?
7packagetest;
newTest().method();
?
、trueorfalse8packagetest;
Stringstr1=newString(abc);
Stringstr2=newString(abc);
StringBuffersb1=newStringBuffer(abc);
StringBuffersb2=newStringBuffer(abc);
9、输出的结果是什么?
publicintmethod1(){
intx=1;
try{
returnx;
}finally{
++x;
publicintmethod2(){
return++x;
这样呢?
输出什么packagetest;
publicstaticbooleanmethod(){
try{
returntrue;
}finally{
returnfalse;
}
m2有区别吗?
什么区别10、方法m1和packagetest;
publicsynchronizedvoidm1(){
publicstaticsynchronizedvoidm2(){
?
理由、11trueorfalsepackagetest;
Integeri1=127;
Integeri2=127;
i1=128;
i2=128;
trueorfalse?
理由12、packagetest;
Stringstr1=a;
Stringstr2=a;
Stringstr3=newString(a);
str3=str3.intern();
、trueorfalse?
理由13packagetest;
14、以下代码输出是什么?
BigIntegerone=newBigInteger();
BigIntegertwo=newBigInteger();
BigIntegerthree=newBigInteger();
BigIntegersum=newBigInteger(
sum.add(one);
sum.add(two);
sum.add(three);
根据单词排序?
还是?
、输出的结果是什么?
1234515packagetest;
Set<
String>
set=newHashSet<
();
set.add(one);
set.add(wo);
set.add(hree);
set.add(
our);
ive);
for(Iterator<
it=set.iterator();
it.hasNext();
){
、以下代码输出的结果(笔试选择题)16publicclassTest{
C.TestB.0A.null
、下面为一个单例的实现代码,请指出代码中有几个错误或不合理之处,并改正。
17publicclassTest{
publicTestinstance=null;
publicstaticTestgetInstance(){
if(instance==null){
instance=newTest();
returninstance;
。
(笔试)18、编程输出一个目录下的所有目录及文件名称,目录之间用tab(笔试)个整数,然后从大到小输出。
19、从键盘读入10容器,手写个试试?
Map20、如何迭代答案:
、18
、2i1+i2=1010
语法错误
i1*i2=100
i1/i2=1
、3string
、45
19
、5.
、6
1211.0
12.0
testtest
7、test.Testtest.Base
、8truefalse
9、12false
、10A:
synchronizedstatic是某个类的范围,synchronizedstaticcSync{}防止多个线程同时访问这个类中的synchronizedstatic方法。
它可以对类的所有对象实例起作用。
?
B:
synchronized是某实例的范围,synchronizedisSync(){}防止多个线程同时访问这个实例中的synchronized方法。
、11true
false
、12truefalse
true
13、false
、140
、15two
five
one
three
four
、16B
、17getInstance无默认返回值
staticinstance?
必须是
、18packagetest;
newTest().read(D:
/test,\);
publicvoidread(Stringpath,Stringtab){
Filefile=newFile(path);
File[]childFiles=file.listFiles();
for(inti=0;
childFiles!
=null&
&
i<
childFiles.length;
i++){
if(childFiles[i].isDirectory()){
read(childFiles[i].getPath(),tab+\);
、19packagetest;
Scannerin=newScanner(System.in);
//注意这里的数组,不是int的
Integer[]arr=newInteger[10];
10;
arr[i]=in.nextInt();
Arrays.sort(arr,newComparator<
Integer>
(){
@Override
publicintcompare(Integero1,Integero2){
if(o1>
o2)return-1;
if(o1<
o2)return1;
return0;
});
}
、20packagetest;
Map<
Class,String>
m=newHashMap<
Entry<
>
set=m.entrySet();
Iterator<
while(it.hasNext()){
Map.Entry<
entry=it.next();
Classkey=entry.getKey();
Stringvalue=entry.getValue();