面試題總結

  

1. JSP中動態INCLUDE與靜態INCLUDE的區別

 
動態INCLUDE在使用的時候,會先解析所要包含的頁面,解析後在和主頁面放到一起顯示;
靜態INCLUDE在使用的時候,不會解析所要包含的頁面,也就是說,中有什麼,我的任務就是把你包含並顯示,其他的一概不管
jsp:include是先編譯一下included.jsp文件,然後再包含        先編譯,後包含
@ include是先把文件包含就來,然後統一編譯                   先包含,後編譯

2.下列語句哪一個正確()

  A.Java程序經編譯後會產生machinecode

  B.Java程序經編譯後會產生bytecode

  C.Java程序經編譯後會產生DLL

  D.以上都不正確

  答案:B

3.下列語句正確的是()

  A.形式參數可被視爲localvariable

  B.形式參數可被字段修飾符修飾

  C.形式參數爲方法被調用時,真正被傳遞的參數

  D.形式參數不可以是對象

  答案:A

4.下列說法正確的有()

  A.環境變量可在編譯sourcecode時指定

  B.在編譯程序時,所能指定的環境變量不包括classpath

  C.javac一次可同時編譯數個Java源文件

  D.javac.exe能指定編譯結果要置於哪個目錄(directory)

  答案:BCD

5.不能用來修飾interface的有()

  A.privateB.publicC.protectedD.static

  答案:ACD

  

  6.下列正確的有()

  A.callbyvalue不會改變實際參數的數值

  B.callbyreference能改變實際參數的參考地址

  C.callbyreference不能改變實際參數的參考地址

  D.callbyreference能改變實際參數的內容

  答案:ACD

6.下列說法錯誤的有()

  A.Java面嚮對象語言容許單獨的過程與函數存在

  B.Java面嚮對象語言容許單獨的方法存在

  C.Java語言中的方法屬於類中的成員(member)

  D.Java語言中的方法必定隸屬於某一類(對象),調用方法與過程或函數相同

  答案:ABC

  

  7.下列說法錯誤的有()

  A.能被java.exe成功運行的javaclass文件必須有main()方法

  B.J2SDK就是JavaAPI

  C.Appletviewer.exe可利用jar選項運行.jar文件

  D.能被Appletviewer成功運行的javaclass文件必須有main()方法

  答案:BCD

     1.  將//qweer4e-dsfsdf5ty變成  qweereeee@dsfsdfttttty
	public static String dec(String str){
		String value="";		
		value= str.replace("-", "@");
		 for(int i=0;i<str.length();i++){
			 int temp =str.charAt(i);			 
			 if(temp>=48&&temp<=57){			
			   String tempStr="";
			   for(int j=0; j<temp-48;j++){
			     tempStr+=str.charAt(i+1);
		          }
			   value = value.replace(str.substring(i, i+2), tempStr);
				
			 }
		 }
		return value;
	}
	2.求<span style="color: rgb(51, 51, 51); font-family: arial, 宋體, sans-serif; font-size: 14px; line-height: 24px; text-indent: 28px;">斐波那契數列的第n項: 一般法</span>
	public static double getFb(int n){
		List<Integer> list = new ArrayList<Integer>();   //List<int>錯誤  List<Object>
		for (int i=0;i<n;i++){
			list.add(1);
		}
		
		for(int j=2;j<list.size();j++){
	      list.set(j, list.get(j-1)+list.get(j-2));
		}
		return (<span style="font-family: arial, 'courier new', courier, 宋體, monospace; white-space: pre-wrap;">double </span><span style="font-family: arial, 'courier new', courier, 宋體, monospace; white-space: pre-wrap;">)(list.toArray()[n-1]);</span>
	}
    
	 <pre name="code" class="java" style="color: rgb(51, 51, 51); font-size: 14px; line-height: 24px;">求<span style="font-family: arial, 宋體, sans-serif;">斐波那契數列的第n項: </span><span style="font-family: arial, 'courier new', courier, 宋體, monospace; white-space: pre-wrap;">迭代法</span>
public static int getFba(int n){if(n==1||n==2){return 1;}else{return getFba(n-1)+getFba(n-2);}}3.平方和 1^2+2^2+3^2+....n^2 //迭代法
public static double getEn(int n){if(n<=1){return 1;}else{return n*n+getEn(n-1);}}3.近似求圓周率public static float getPi(double n){float x=0;float y=0;double sum =0;
                <span style="font-family: arial, 'courier new', courier, 宋體, monospace; white-space: pre-wrap;"> if(n==0){</span>
return 0; }for(int i=0;i<n;i++){x= new Random().nextFloat();y= new Random().nextFloat();if(x*x+y*y<=1f){sum+=1;}} return (float) (sum/n)*4;} 4.簡單排序
 public static void px(int[] arr){
		int temp =0;
		for(int i=0; i<arr.length-1;i++){
			for(int j=i+1; j<arr.length;j++){
				if(arr[i]<arr[j]){
					temp = arr[j];
					arr[j]= arr[i];
					arr[i] =temp;
				}
			}
		}
		for(int i=0; i<arr.length;i++){			
			System.out.println(arr[i]);
		} 
		
	}
	4.插入法排序
	public static void px2(int[] arr){
		
		int temp =0;
		for(int i=1; i<arr.length;i++){
			int j=i-1;
			temp = arr[i];
			while(j>=0&&arr[j]<temp){	
				arr[j+1] = arr[j];
				j--;
			}
			 arr[j+1]= temp;
		}
		
		for(int i=0; i<arr.length;i++){			
			System.out.println(arr[i]);
		} 
		
	}

sql 
1. 刪除 name字段 重複記錄保留第一個
delete employ
 where id not in (
       select max(id) 
       from  employ
       group by name
       having count(id)>1 
);
將一個表的記錄更新到另外一張表中
update zk_xxx z set z.fxrq = (
   select f.blrq 
   from zk_fxx f
   where f.fid=z.zid
   
)
where  z.nsrsb ='201410221' ;








發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章