文档详情

JAVA程序员面试题.docx

发布:2022-06-09约2.39千字共2页下载文档
文本预览下载声明
第 第 PAGE 1 页 共 NUMPAGES 1 页 JAVA程序员面试题 1、数据库 表a和表b具有彻低相同的结构,主键为indexid。写出一个sql语句把表b中不存在而表a中存在的数据插入到表b中。 2、javascript部分 页面中有一个名称都为unitprice的type=text对象。要求输入的数据不能为空,写一个函数实现该功能,假如为空时给出提醒。 3、JSP部分 ①session中存储一个String变量,变量名称为studentname,写出在jsp中如何得到这个session变量的值的语句。 ②在jsp中引用用法来引用javabean. Ⅰscope的值有哪些,这些值的区分是什么? Ⅱ不同的jsp页面中引用javabean时,id能否相同,假如能相同,对scope的值有什么要求? 4、JAVA部分 ①输入一个维数,输出以下形式的矩阵和数列,以维数n=4为例: 0000 0111 0122 0123 ②写出下面这段程序的运行结果 int a=2,b=3,c=1 a+=–b+c; c-=b+a++; System.out.println(“a=”+a+”,b=”+b+”,c=”+c); 5、有一个Vector对象,其中每一个元素都是一个String对象,请用for循环或while循环输出Vector中的元素,要求格式为:”第i个元素为:aaa” 6、有一个HashMap其中key为String对象,value为Integer对象,写一个办法打印出此Map中的全部键值 对形如 key–value 7、有一个String str=”001,A001;002,A002;003,A003″的串,写一个办法,把此串存入列 一个HashMap或Hashtable中,解释:如001为key,A001则为value。 8、面对对象概念: ①面对对象基本特征 ②什么叫多态和重载,它们有什么区分? ③用你自己的话描述你理解的j2ee的本质特征是什么? 第一题: 写一个办法,实现删除链表中某个节点的操作(其他条件自己假设,补充) public void delete() { if(front=rear) { s[front] =0; front–; System.out.println(“\ndelete successful”); } else { System.out.println(“the link is empty ,can’t delete”); } } 其次题:写一个办法,实现堆栈的入栈操作 (其他条件自己假设,补充) public class stack{ private int[] s; int top,bottom; public stack(int size){ s = new int[size]; top = size-1; bottom = size-1; System.out.println(“Size of the stack is:”+size); } public boolean isEmpty() { if(top==s.length-1) return true; else return false; } public void push(int n) { if(top=s.length-1) { System.out.println(“The stack is empty,Can’t pop now!”); return; } else { top++; } } public void print() { System.out.println(“State of the stack:”); for(int i=s.length-1;itop;i–) { System.out.print(s[i]+” ”); } } public static void main(String[] a) { stack st = new stack(5); System.out.println(“List of the action to the stack:”); System.out.println(“push(3):”); st.push(3); st.print(); System.out.println(” ”); System.out.println(“push(6)”); st.push(6); st.print(); System.out.println(” ”); System.out.println(“push(10)”); st.push(10); st.print(); System.out.println(” ”); System.out.println(“pop()
显示全部
相似文档