面试题总结

  

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' ;






 


                
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值