Java笔试题推荐

一、100,100,102,106,112,120 ,130

Java笔试题推荐

0,2,4,6,8

x-8 = 2

x = 10

n-120 = x

n = 130

二、有两个数组A,B,B数组中的元素包含在A数组中,请写一段代码把A数组中B没有的元素放到C数组中。

int [] A = new int[]{0,1,2,3,4,5,6,7,8,9};

int [] B = new int[]{2,4,6,8};

int [] C =new int[th];

int count = 0;

for(int i = 0;i < th;i++){

boolean bool = true;

for(int j = 0;j < th;j++){

if(A == B[j]){

bool = false;

}

}

if(bool){

C[count] = A;

count++;

}

}

for(int i = 0;i < th;i++){

tln(C);

}

三、假如数组中都是数字,而且已经按大小排序,请写一段代码最快效率把上一题的`元素放到C数组中。

int [] num = new int[]{0,1,2,3,4,5,6,7,8,9};

int [] temp = new int[th];

temp = num;

for(int i = 0;i < th;i++){

tln(temp);

}

四、写一个对数组的排序的代码段。

int [] num = new int[]{4,6,2,7,1,3,9,8,5,0};

for(int i = 0;i < th;i++){

for(int j =0;j < th;j++){

if(num < num[j]){

int temp = 0;

temp = num;

num = num[j];

num[j] = temp;

}

}

}

for(int i = 0;i < th;i++){

tln(num);

}

五、jsp与servlet的区别?它们的生命周期?jsp或servlet的转发(forword),包含(include),重定向(Redirect)的区别?

六、MVC的概念?你用过哪些基于MVC的框架?