false
2.public class Test{
public static void main(String[] args){
int x = 100;
int y = 200;
if(x == y)
System.out.println("not equal");
else
System.out.println("equal");
}
}
榪愯緇撴灉錛?br />equal
3.public class TestKnowleage5 {
public static void main(String[] args){
try{
new TestKnowleage5().methodA(5);
}catch(IOException e){
System.out.println("caught IOException");
}catch(Exception e){
System.out.println("caught Exception");
}finally{
System.out.println("no Exception");
}
}
public void methodA(int i) throws IOException{
if(i%2 != 0){
throw new IOException("methodA IOException");
}
}
}
榪愯緇撴灉錛?br />
caught IOException
no Exception
4.public class TestKnowleage5 {
static boolean isTrue(){
System.out.println("isTrue");
return true;
}
static boolean isFalse(){
System.out.println("isFalse");
return false;
}
public static void main(String[] args){
if(isTrue() || isFalse()){
System.out.println("|| operate return true");
}
if(isFalse() & isTrue()){
System.out.println("& operate return true");
}
}
}
榪愯緇撴灉錛?br />
isTrue
|| operate return true
isFalse
isTrue
5.public class TestKnowleage5{
public static void main(String args[]){
MyThread t = new MyThread();
t.run();
t.start();
System.out.println("A");
}
}
class MyThread extends Thread{
public void run(){
try{
Thread.currentThread().sleep(3000);
}catch(InterruptedException e){
}
System.out.println("B");
}
}
榪愯緇撴灉錛?br />BBA鎴?br />BAB
6.class A{
void fun1(){
System.out.println(fun2());
}
int fun2(){
return 123;
}
}
public class TestKnowleage5 extends A{
int fun2(){
return 456;
}
public static void main(String[] args){
A a;
TestKnowleage5 b = new TestKnowleage5();
b.fun1();
a = b;
a.fun1();
}
}
榪愯緇撴灉錛?br />
7.class A{
int val;
public int getVal() {
return val;
}
public void setVal(int val) {
this.val = val;
}
}
public class TestKnowleage5{
public static void main(String[] args){
A data = new A();
ArrayList list = new ArrayList();
for(int i=100;i<103;i++){
data.setVal(i);
list.add(data);
}
int j = 0;
while(j<list.size()){
A tmp = (A)list.get(j);
System.out.println("list("+j+")="+tmp.getVal());
j++;
}
}
}
榪愯緇撴灉錛?br />
list(0)=102
list(1)=102
list(2)=102
8.hibernate瀵煎叆澶ч噺鏁版嵁鏃訛紝涓轟簡閬垮厤鍐呭瓨涓駭鐢熷ぇ閲忓璞★紝鍦ㄧ紪鐮佹椂娉ㄦ剰浠涔堬紝濡備綍鍘婚櫎錛?br />
9.瑙嗗浘涓庤〃鐨勫尯鍒?br />10.瑙﹀彂鍣ㄦ湁鍝嚑縐嶇被鍨?br />11.
浜嬪姟鎿嶄綔鏈夐偅鍑犱釜姝ラ
12.鍐欏嚭瀵瑰簲姝e垯琛ㄨ揪寮忥細(xì)
1錛?-6浣嶅瓧姣嶆垨鏁板瓧錛?br />[a-zA-Z0-9]{1,6}
2錛夋墜鏈哄彿錛堝彧鑳芥槸139鎴?59寮澶達(dá)紝11浣嶆暟瀛楋級
1[35][9][0-9]{8}
13.瀛楃涓插弽杞細(xì)new StringBuilder(str).reverse().toString();
14.鍐欑▼搴忥細(xì)1+2²+3²+...+n²
int func(int n){
return n==1?1:func(n-1)+n*n
}
15.鍐欎竴涓歡榪熷姞杞界殑鍗曚緥妯″紡錛?br />public class SingleTon{
private static SingleTon instance = null;
private SingleTon(){}
public static SingleTon getInstance(){
if(instance == null){
synchronized(""){
if(instance == null){return new SingleTon();}
}
}
return instance;
}
}
16.
JSP鐨?縐嶅唴緗璞★細(xì)request錛?div style="display: inline-block; ">
HttpServletRequest綾葷殑瀹炰緥錛?div style="display: inline-block; ">