JAVA工程师笔试题

第一篇:JAVA工程师笔试题

       一、选择题

       1.Java中提供了名为()的包装类来包装原始字符串类型。A.Integer B.Char C.Double D.String

       2.java.lang包的()方法比较两个对象是否相等,相等返回true。A.toString()B.equals()C.compare()

       D.以上所有选项都不正确

       3.下面的集合中,()不可以存储重复元素。A.Set B.Collection C.Map D.List 4.Java接口的修饰符可以为()

       A private B protected C final D abstract

       5.下面哪些是Thread类的方法()

       A start()B run()C exit()D getPriority()

       6.下面关于java.lang.Exception类的说法正确的是()

       A 继承自Throwable B Serialable C集成自Error D以上都不正确

       7.下面程序的运行结果:()

       public static void main(String[] args){ // TODO Auto-generated method stub Thread t = new Thread(){ public void run(){ pong();} };t.run();System.out.print(“ping”);} static void pong(){ System.out.print(“pong”);}

       A pingpong B pongping C pingpong和pongping都有可能 D 都不输出

       8.下面哪个流类属于面向字符的输入流()A BufferedWriter B FileInputStream C ObjectInputStream D InputStreamReader

       9.ArrayList list = new ArrayList(20);中的list扩充几次()

       A 0 B 1 C 2 D 3

       二、问答题

       1.String与StringBuffer的区别?

       2.谈谈final、finally、finalize的区别?

       3.创建一个对象的方法有哪些?

       4.编写一个程序,产生ArrayIndexOutOfBoundsException异常,并捕获该异常,在控制台输出异常信息。

       5.写一个线程安全的Singleton实例

       6.请用JAVA代码实现拷贝一个大于2G的文件到其他盘。

       7.设计四个线程,其中两个线程每次对变量i加1,另外两个线程每次对i减1.8.自己编写代码,实现生产者-消费者模型功能.内容自由发挥,只需要表达思想.9.在Mysql中,请用一条SQL语句将现有的三条记录复制一下,达到以下的效果: ID name pass

       aaa 111

       bbb 222

       ccc 333

       aaa 111

       bbb 222

       ccc 333

       10.用SQL语句删除上一题的重复记录.。

第二篇:Java开发工程师笔试题

       Java开发工程师笔试题

       一、单项选择题(每题2分,共计30分)

       1.下列哪一种叙述是正确的(A).abstract修饰符可修饰字段、方法和类

       (B).抽象方法的body部分必须用一对大括号{}包住

       (C).声明抽象方法,大括号可有可无

       (D).声明抽象方法不可写出大括号

       2.如下代码

       public class Test {

       public int aMethod(){

       static int i = 0;

       i ;

       return i;

       }

       public static void main(String args[]){

       Test test = new Test();

       test.aMethod();

       int j = test.aMethod();

       System.out.println(j);

       }

       }

       输出结果是什么?

       (A).0

       (B).1

       (C).2

       (D).编译失败

       3.以下代码的输出结果是()?

       public class Test1{

       public static void main(String[] args){int i = 42;

       String s =(i < 40)? “life” :(i > 50)? “universe” : “everything”;System.out.println(s);

       }

       }

       (A).life

       (B).universe

       (C).everything

       (D).以上答案都不对。

       4.当你编译和运行下面的代码时,会出现下面选项中的哪种情况?

       public class Test{

       static boolean paddy;

       public static void main(String[] args){

       System.out.println(paddy);

       }

       }

       (A).编译时出错

       (B).编译通过并输出结果false

       (C).编译通过并输出结果true

       (D).编译通过并输出结果null

       5.如下代码:

       class Base {

       public Base(){

       System.out.print(“Base”);

       }

       }

       public class Alpha extends Base {

       public static void main(String[] args){

       new Alpha();

       new Base();

       }

       }

       结果是什么?

       (A).Base

       (B).BaseBase

       (C).编译失败.(D).代码运行但没有输出.(E).运行时抛出异常

       6.如下代码:

       public class Foo {

       public static void main(String[] args){

       try {

       return;

       } finally {

       System.out.println(“Finally”);

       }

       }

       }

       输出结果是什么?

       (A).Finally

       (B).编译失败

       (C).代码正常运行但没有任何输出.(D).运行时抛出异常

       7.下列关于构造方法的叙述中,错误的是()

       (A).Java语言规定构造方法名与类名必须相同

       (B).Java语言规定构造方法没有返回值,但不用vold声明

       (C).Java语言规定构造方法不可以重载

       (D).Java语言规定构造方法只能通过new自动调用

       8.构造函数何时被调用()

       (A).类定义时

       (B).创建对象时

       (C).调用对象方法时

       (D).使用对象的变量时

       9.JDBC中,用于表示数据库连接的对象是:

       (A).Statement

       (B).Connection

       (C).DriverManager

       (D).PreparedStatement

       10.需要读一个比较大的文本文件,这个文件里有很多字节数据,那么下列最合适读这

       类文件的选项是哪一个?

       (A).new FileInputStream(“myfile.txt”);

       (B).new InputStreamReader(new FileInputStream(“myfile.txt”));

       (C).new BufferedReader(new InputStreamReader(new FileInputStream(“myfile.txt”)));

       (D).RandomAccessFile raf = new RandomAccessFile(“myfile.txt”, “ rw”);

       11.在List,Map,Set等接口中,不能包含重复元素的接口是哪一个?

       (A).List

       (B).Map

       (C).Set

       (D).都不是

       12.有如下程序:

       1.classTest4{

       2.public static void main(String []args){

       3.boolean x=;

       4.boolean y=false;

       5.short z=42;

       6.7.if((z ==42)&&(y=true))z ;8.if((x=false)||( z==45))z ;9. 10.System.out.println(“z=” z);11.} 12.} 结果为:

       (A).44

       (B).45

       (C).46

       (D).编译出错

       13.有如下程序

       11.public class Test {

       12.public static void main(String [] args){

       13.int x =5;

       14.boolean b1 = true;

       15.boolean b2 = false;

       16.17.if((x==4)&&!b2)

       18.System.out.print(“l ”);

       19.System.out.print(“2 ”);

       20.if((b2 = true)&& b1)

       21.System.out.print(“3”);

       22.}

       23.}

       运行的结果为:

       (A).2

       (B).3

       (C).1 2

       (D).2 3

       (E).1 2 3

       (F).编译错误

       (G).抛出一个运行时异常

       14.以下语句有语法错的是:

       (A).int x=1;y=2;z=3

       (B).for(int x=10,y=0;x>0;x );

       (C).while(x>5);

       (D).for(;;);

       15.下面有关类 Demo 的描述正确的有()

       public class Demo extends Base{

       private int count;

       public Demo(){

       System.out.println(“A Demo object has been created”);

       }

       protected void assone(){

       count ;

       }

       }

       (A).当创建一个 Demo 类的实例对象时,count 的值为 0

       (B).当创建一个 Demo 类的实例对象时,count 的值是不确定的(C).Base 类型的对象中可以包含改变 count 值的方法

       (D).Demo 的子类对象可以访问 count

       二、1.2.3.4.5.问答题(每题5分,共计25分)String是最基本的数据类型吗? String 和StringBuffer的区别? Java中的“==”和equals()方法有什么区别? 描述一下JSP中转发和重定向的区别? 请说出作用域public,private,protected,以及不写时的区别? List, Set, Map是否继承自Collection接口?分别说出它们的特点?

       三、编程题(每题15分,共计45分)

       1.已知有一个数列:f(0)= 1,f(1)= 4,f(n 2)=2*f(n 1) f(n),其中n是大于0的整数,求f(10)的值。

       2.写一个算法对1,8,5,2,4,9,7进行顺序排列。

       3.使用输入输出流的API实现文件拷贝功能。

第三篇:软件开发工程师(JAVA)笔试题A

       JAVA笔试题

        软件开发工程师(JAVA)笔试题

       请在90分钟以内做答 答案请写在答题纸上

       一、选择题

       1、下面哪项是不合法的标识符:(c e)A.$persons B.TwoUsers C.*point D._endline E.final

       2、下列运算符合法的是(a)

       A.&& B.<> C.if D.:=

       3、下面描述中哪两项相等:(bg)[选择两项] A.<%= YoshiBean.size%> B.<%= YoshiBean.getSize()%> C.<%= YoshiBean.getProperty(“size”)%>

       D. E. F. G.

       4、设float x = 1,y = 2,z = 3,则表达式 y =z--/ x的值是:(a)A.3.5 B.3 C.4 D.5 A.equals()方法判定引用值是否指向同一对象 B.==操作符判定两个不同的对象的内容和类型是否一致 C.equal()方法只有在两个对象的内容一致时返回true D.类File重写方法equals()在两个不同的对象的内容和类型一致时返回true

       6、如果一个对象仅仅声明实现了cloneable接口,但是不声明clone方法,外部能够调用其clone方法吗?(b)A.能 B.不能 C.不确定

       7、下列说法错误的有(bd)

       A. 能被java.exe成功运行的java class文件必须有main()方法

       B. J2SDK就是Java API

       C. Appletviewer.exe可利用jar选项运行.jar文件

       D. 能被Appletviewer成功运行的java class文件必须有main()方法

       8、下列正确的有(acd)

       A. call by value不会改变实际参数的数值

       B. call by reference能改变实际参数的参考地址

       C. call by reference不能改变实际参数的参考地址

       D. call by reference能改变实际参数的内容

       9、下列说法错误的有(bcd)

       A. 数组是一种对象

       B. 数组属于一种原生类

       C. int number=[]={31,23,33,43,35,63}

       5、下面的哪些叙述为真:(d)

       D. 数组的大小可以任意改变

       10、不能用来修饰interface的有(ad)

       JAVA笔试题

       A.private B.public C.protected D.static

       11、关于Float,下列说法正确的是(a)

       A.Float是一个类 B.Float在java.lang包中 C.Float a=1.0是正确的赋值方法

       D.Float a= new Float(1.0)是正确的赋值方法

       12、下列哪种说法是正确的(d)

       A. 实例方法可直接调用超类的实例方法

       B. 实例方法可直接调用超类的类方法

       C. 实例方法可直接调用其他类的实例方法

       D. 实例方法可直接调用本类的类方法

       13、下列说法错误的有(c)

       A.在类方法中可用this来调用本类的类方法

       B.在类方法中调用本类的类方法时可直接调用

       C.在类方法中只能调用本类中的类方法

       D.在类方法中绝对不能调用实例方法

       14、下面说法哪些是正确的? bd

       A.Applet可以访问本地文件

       B.对static方法的调用不需要类实例 C.socket类在java.lang中 D.127.0.0.1地址代表本机 1.public class Test1 { 2.public float aMethod(float a, float b)throws 3.IOException { } 4.} 5.public class Test2 extends Test1 { 6.//Line6 7.} 将以下(ac)方法插入行6是不合法的。

       A.float aMethod(float a, float b){} B.public int aMethod(int a, int b)throws Exception {} C.public float aMethod(float P, float q){} D.public int aMethod(int a, int b)throws IOException {}

       16、关于以下程序段,正确的说法是:(b)

       1.String s1 = “abc” “def”;2.String s2 = new String(s1);3.if(s1.equals(s2))4.System.out.println(“.equals()succeeded”);5.if(s1 == s2)6.System.out.println(“== succeeded”);A.行4与行6都将执行 B.行4执行,行6不执行 ??

       15、类Test1、Test2定义如下:

       C.行6执行,行4不执行 D.行

       4、行6都不执行

       JAVA笔试题

       17、下面程序的执行结果为:(a)

       1.public class Test { 2.static Boolean foo(char c){ 3.System.out.println(c);4.return true;5.} 6.public static void main(String[] args){ 7.int i = 0;8.for(foo(‘A’);foo(‘B’)&&(i<2);foo(‘C’)){ 9.i ;10.foo(‘D’);11.} 12.} 13.} A.ABDCBDCB B.ABCDABCD C.Compilation fails C.An exception is thrown at runtime

       18、阅读下面的程序

       1.public class Outer { 2.public void someOuterMethod(){ 3.//Line3 4.} 5.public class Inner(){} 6.public static void main(String[] args){ 7.Outer o = new Outer();8.//Line8 9.} 10.} Which instantiates is an instance of Inner?(c)

       A.new Inner();// At line3 B.new Inner();// At line 8 C.new o.Inner();// At line 8 C.new Outer.inner();// At line 8

       19、选出能正确赋值的: public class TestA { private int a;return m;public int change(int m){

       } } public class TestB extend TestA{ public int b;public static void main(){ TestA aa = new TestA();int k;

       TestB bb = new TestB();

       } } 在Line13处可以正确赋值的有:(d)// Line 13

       JAVA笔试题

       A.k= m;B.k=b;C.k=aa.a;D.k=bb.change(30);E.k=bb.a 20、已知如下代码: switch(m){ case 0: System.out.println(“Condition 0”);case 1: System.out.println(“Condition 1”);case 2: System.out.println(“Condition 2”);case 3: System.out.println(“Condition 3”);break;default: System.out.println(“Other Condition”);} 当 m 的值为什么时输出 “Condition 2”?(abc)A.0 B.1 C.2 D.3 E.4 F.None

       21、给出程序段

       public class Parent { public int addValue(int a,int b){ int s;s=a b;return s;} } class Child extends Parent{} 可以加在Child类的方法有:(cd)A.int addValue(int a,int b){} B.public void addValue(int a,int b){} C.public int addValue(int a){} D.public int addValue(int a,int b){}

       22、下述哪些说法是正确的?(d)A.实例变量是类的成员变量

       B.实例变量是用static关键字声明的 C.方法变量在方法执行时创建 D.方法变量在使用之前必须初始化

       23、对于下列代码:

       public class Sample{

       long length;

       public Sample(long l){ length = l;}

       public static void main(String arg[]){

       Sample s1, s2, s3;

       s1 = new Sample(21L);

       s2 = new Sample(21L);

       s3 = s2;

       long m = 21L;

       } } 下列哪些表达式返回值为'true'?(d)

       JAVA笔试题

       A.s1 = = s2;B.s2 = = s3;C.m = = s1;D.s1.equals(m)

       26、当 Frame 改变大小时,放在其中的按钮大小不变,则使用如下哪个 layout?(e)A.FlowLayout B.CardLayout C.North and South of BorderLayout D.East and West of BorderLayout E.GridLayout

       27、已知如下的命令执行 java MyTest a b c 请问哪个语句是正确的?(cd)A.args[0] = “MyTest a b c” B.args[0] = “MyTest” C.args[0] = “a” D.args[1]= “b”

       28、下面哪个语句是创建数组的正确语句?(ab)A.float f[][] = new float[6][6];B.float []f[] = new float[6][6];C.float f[][] = new float[][6];D.float [][]f = new float[6][6];E.float [][]f = new float[6][];30、以下关于数据库范式的描述,哪些是错误的(c)

       A.如果把多个数据项用一个大的 String 表示为一个字段,则不满足

       private String name;public String getName(){ return name;} public Ball(String name){ this.name = name;} public void play(){ ball = new Ball(“Football”);

       JAVA笔试题

       System.out.println(ball.getName());} } 上面代码是否有错,如果有错,错误在何处? 红处

       2、详细解释下面的语句: Class.class.getClass()Class与class继承自Object,class试题来代表java运行时的class和interface等等 Class.class就是得到或者生成这个Class类的Class Object 而getClass()本身就是返回一个类对应的Class Object,所以最后Class.class.getClass()最后还是返回Class Object

       7、编写一个截取字符串的函数,输入为一个字符串和字节数,输出为按字节截取的字符串。但是要保证汉字不被截半个,如“我ABC”4,应该截为“我AB”,输入“我ABC汉DEF”,应该输出为“我ABC”而不是“我ABC 汉的半个”。

       public static boolean isLetter(char c){ int k=0X80;return c/k==0?true:false;}

       public static int lengths(String strSrc){ if(strSrc==null){ return 0;} int len=0;char[] strChar=strSrc.toCharArray();for(int i=0;i

       JAVA笔试题

       public static String subString(String origin,int len){ if(origin==null || origin.equals(“")|| len<1){ return ”“;} if(len>lengths(origin)){ return origin;} byte[] strByte=new byte[len];System.arraycopy(origin.getBytes(),0,strByte,0,len);int count=0;for(int i=0;i

       }

       public static void main(String[] args){ System.out.println(”“ subString(”我ABC汉DEF",6));}

       10、SQL问答题

       表结构:

       1、表名:g_cardapply 字段(字段名/类型/长度):

       g_applyno varchar 8: //申请单号(关键字)g_applydate bigint 8: //申请日期 g_state varchar 2: //申请状态

       2、表名:g_cardapplydetail 字段(字段名/类型/长度):

       g_applyno varchar 8: //申请单号(关键字)g_name varchar 30: //申请人姓名 g_idcard varchar 18: //申请人身份证号 g_state varchar 2: //申请状态

       其中,两个表的关联字为申请单号 题目:

       JAVA笔试题

       1、查询身份证号码为***082的申请日期

       2、查询同一个身份证号码有两条以上记录的身份证号码及记录个数

       3、将身份证号码为***082的记录在两个表中的申请状态均改为07

       4、删除g_cardapplydetail表中所有姓李的记录

       1、select g_applydate from g_cardapply a,g_cardapplydetail b where a.g_applyno=b.g_applyno and b.g_idcard=’***082’

       2、select g_idcard,count(g_applyno)from g_cardapplydetail group by g_idcard having count(g_applyno)>2

       3、update g_cardapply a,g_cardapplydetail b set a.g_state=’07’,b.g_state=’07’ where a.g_applyno=b.applyno and b.g_idcard=’ ***082’

       4、delete from g_cardapplydetail where g_name like ‘李%’

第四篇:Java软件开发工程师笔试题

       Java软件开发工程师笔试题

       一、选择题(25 x 2’ = 50’)

       1、一个Java程序运行从上到下的环境次序是()

       A. 操作系统、Java程序、JRE/JVM、硬件 B. JRE/JVM、Java程序、硬件、操作系统 C. Java程序、JRE/JVM、操作系统、硬件 D. Java程序、操作系统、JRE/JVM、硬件

       2、下面代码中的第2行可以插入一行代码()保证程序编译通过。

       1、public interface A{ 2、3、} A.void method();B.public void method();C.static void method();D.private void method();E.protected void method();

       3、关于异常下列描述中,错误的是()

       A.异常机制可以用于流程控制

       B.finally代码段在发生异常时不一定必须执行

       C.在catch代码段中可以使用return语句来返回到异常抛出点

       D.可以把catch到的异常对象再次抛出,使上层try—catch结构继续处理该异常事件

       4、关于被私有访问控制符private修饰的成员变量,以下说法正确的是()

       A. 可以被三种类所引用:该类自身、与它在同一个包中的其他类、在其他包中的该类的子类 B. 可以被两种类访问和引用:该类本身、该类的所有子类 C. 只能被该类自身所访问和修改 D. 只能被同一个包中的类访问

       5、某类Example的main()方法参数为args,当命令行中输入Java Example cat时,args[0]的值为()。

       A. cat

       B. Java

       C. example

       D. null

       6、下面关于Thread类提供的现成控制方法的说法中,错误的是()

       A. 在线程A中执行现成B的join方法,则线程A等待直到线程B执行完成。B. 线程A通过调用iterrupt方法来中断其阻塞状态

       C. 若线程A调用方法isAlive返回值为true,则说明A正在执行中 D. currentThread方法返回当前线程的引用

       7、类Test1定义如下:

       1.public class Test1{ 2.

       public float aMethod(float a,float b){ }

       1/10

       3.4.}

       将以下哪种方法插入行3是不合法的。()

       A. public float aMethod(float a,float b,float c){ } B. public float aMethod(float c,float d){ } C. public int aMethod(int a,int b){ } D. private float aMethod(int a,int b,int c){ }

       8、下面程序的输出结果是()private static void foo(){ try { System.out.println(“try”);foo();} catch(Throwable e){ System.out.println(“catch”);foo();} finally { System.out.println(“finally”);foo();} }

       public static void main(String[] args){ foo();} A.执行一段时间后报栈溢出。B.会一直输出“try”。

       C.会一直输出“try”和“finally”。D.会一直输出“try”、“catch”和“finally”

       9、下面的哪些程序片断可能导致错误?()A.String s = “Gone with the wind”;String t = “ good ”;String k = s t;

       B.String s = “Gone with the wind”;String t;t = s[3] “one”;

       C.String s = “Gone with the wind”;String standard = s.toUpperCase();

       D.String s = “home directory”;String t = s-“directory”;

       10、已知如下代码:

       2/10

       1: class Example{ 2: String str;3: public Example(){ 4: 5: } 6: public Example(String s){ 7: 8: } 9:} 10: class Demo extends Example{ 11: } 12: public class Test{ 13: public void f(){ 14: 15: 16: } } 哪句语句会导致错误?()A、line 3 B、line 6 C、line 10 D、line 14 E、line 15

       11、下面的代码中第4行创建的对象在什么时候符合垃圾回收的条件()

       1、class Bar { }

       2、class Test {

       3、Bar doBar(){

       4、Bar b = new Bar();

       5、return b;

       6、}

       7、public static void main(String args[]){

       8、Test t = new Test();

       9、Bar newBar = t.doBar();10、11、12、newBar = new Bar();} } Example ex = new Example(“Good”);Demo d = new Demo(“Good”);str=s;str= “example”;A.程序运行第9行之后。B.程序运行第10行之后。C.doBar方法运行结束之后。D.main方法运行结束之后。

       12、下列关于for循环和while循环的说法中哪个是正确的?()

       A. while循环能实现的操作,for循环也都能实现

       B. while循环判断条件一般是程序结果,for循环判断条件一般是非程序结果

       3/10

       C. 两种循环任何时候都可替换

       D. 两种循环结构中都必须有循环体,循环体不能为空

       13、下述说法中,错误的是()A.Java中,方法的重载是指多个方法可以共享同一个名字 B.Java中,用abstract修饰的类称为抽象类,它不能实例化 C.Java中,接口不包含成员变量和方法实现 D.Java中,构造方法可以有返回值

       14、下面哪些是正确的()

       11.class ClassA {}

       22.ClassB p1 = new ClassB();23.ClassC p2 = new ClassC();24.ClassA p3 = new ClassB();25.ClassA p4 = new ClassC();12.class ClassB extends ClassA {} 13.class ClassC extends ClassA {} and:

       21.ClassA p0 = new ClassA();A.p0 = p1;

       15、以下代码片段,正确的结果是:()

       11.classA {

       17.throw new IOException();

       18.} }

       19.public static void main(String[] args){

       20.try { new B().process();} 21.catch(IOException e){

       22.System.out.println(”Exception”);} } 12.public void process(){ System.out.print(”A,”);} } 13.class B extends A { 15.super.process();A.Exception B.A,B,Exception C.Compilation fails because of an error in line 20.D.Compilation fails because of an error in line 14.E.A NullPointerException is thrown at runtime.16、用直接插入排序方法对下面四个序列进行排序(由小到大),元素比较次数最少的是()。

       A. 94,32,40,90,80,46,21,69 B. 32,40,21,46,69,94,90,80 C. 21,32,46,40,80,69,90,94 D. 90,69,80,46,21,32,94,40

       17、设栈最大长度为3,入栈顺序为1,2,3,4,5,6,则不可能的出栈序列是()

       A.1,2,3,4,5,6 B.2,1,3,4,5,6 C.3,4,2,1,5,6 D.4,3,2,1,5,6

       18、设有98个已排序列元素,采用二分法查找时,最大比较次数是()

       A.49 B.15 C.20 D.7

       4/10

       14.public void process()throws IOException { 16.System.out.print(”B,”);B.p1 =p2;

       C.p2 = p4;

       F.p2 =(ClassC)p4;D.p2 =(ClassC)p1;E.p1 =(ClassB)p3;

       19、若一棵二叉树具有10个度为2的结点,5个度为1的结点,则度为0的结点个数是()

       A.9 B.11 C.15 D.不确定

       20、以下与数据的存储结构无关的术语是()。

       A.循环队列 B.链表 C.哈希表 D.栈

       21、设数组A[10„100,20„100]以行优先的方式顺序存储,每个元素占4个字节,且已知A[10,20]的地址为 1000,则A[50,90]的地址是()

       A.13240 B.14250 C.24220 D.14240

       22、链表不具有的特点是()

       A.插入、删除不需要移动元素 B.可随机访问任一元素 C.不必事先估计存储空间 D.所需空间与线性长度成正比

       23、下面关于线性表的叙述中,错误的是哪一个?()

       A.线性表采用顺序存储,必须占用一片连续的存储单元。B.线性表采用顺序存储,便于进行插入和删除操作。C.线性表采用链接存储,不必占用一片连续的存储单元。D.线性表采用链接存储,便于插入和删除操作。

       24、若一个栈的输入序列为1,2,3,„,n,输出序列的第一个元素是i,则第j个输出元素是()。A.i-j-1 B.i-j C.j-i 1 D.不确定的

       25、下列说法不正确的是()。

       A.图的遍历是从给定的源点出发每一个顶点仅被访问一次 B.图的深度遍历不适用于有向图

       C.遍历的基本算法有两种:深度遍历和广度遍历 D.图的深度遍历是一个递归过程

       二、程序改错(5 * 2’ = 10’)1.----public class Unbelievable { static Integer i;public static void main(String[] args){

       } } if(i == 42)System.out.println(“Unbelievable”);2.——————————————————————————————————

       class Animal {

       public String noise(){

       5/10

       龙通科技有限公司笔试题

       } class Dog extends Animal {

       } class Cat extends Animal {

       } public class Test {

       } public static void main(String[] args){

       } Animal animal = new Dog();Cat cat =(Cat)animal;cat.noise();public String noise(){ } return “meow”;public String noise(){ } return “bark”;} return “peep”;3.——————————————————————————————————————

       abstract class Something { } private abstract String doSomething();4.——————————————————————————————————————

       public class Something {

       } class Other { } public int i;public static void main(String[] args){

       } public void addOne(final Other o){ } o.i ;Other o = new Other();new Something().addOne(o);5.——————————————————————————————————————

       class Something {

       final int i;public void doSomething(){ System.out.println(“i = ” i);6

       龙通科技有限公司笔试题

       } }

       三、程序阅读题(每空2’,共 40’)

       1、阅读以下java代码,写出运行结果

       class StaticTest {

       }

       2、编写将一维数组a[]中互不相同的数按从小到大顺序重新存于一维数组a[]的程序。

       class A{ public static void main(String[] args){

       } for(j=0;j

       } System.out.prinln(a[j]);int a[]={15,7,15,6,4,3,4,6,7};int i,j,k,low,high,mid,t;for(i=k=1;i=a[i])____________;else low=mid 1;} if(____________|| a[low]!=a[i]){ t=a[i];for(j=k-1;__________;j--)a[j 1]=a[j];___________;k ;}

       static int x=1;int y;StaticTest(){ } public static void main(String args[ ]){ StaticTest st=new StaticTest();System.out.println(“x=” x);System.out.println(“st.y=” st.y);st=new StaticTest();System.out.println(“st.y=” st.y);

       } static { x ;} y ;

       龙通科技有限公司笔试题

       }

       3、请用JAVA编写如下程序:此程序处理一个由0和非0数字成员组成的数组(长度自定),例如0 0 1 2 0 1 0 0 0 1 0 0 0 0 0 2 0 7 8 9 0 0 1 2 3 4,把数组中所有连续两个以上的0去掉,将结果存入一个新数组。如上例处理后结果为,1 2 0 1 1 2 0 7 8 9 1 2 3 4。public static void main(String[] args){

       int[] srcArray = {0,0,1,2,0,1,0,0,0,1,0,0,0,0,0,2,0,7,8,9,0,0,1,2,3,4};int[] destArray = new int[50];int i=0,j=0,count=0;for(i=0;i

       } } for(i=0;i

       public static void main(String[] args){

       } public static int Keeper(int peo, int n){ int k = 0;int peo;System.out.println(“请输入人数:”);Scanner inp = new Scanner(System.in);peo = inp.nextInt();int k = Keeper(peo, 3);System.out.println(“最后留下的是 ” k “ 号!”);

       4、有n个人围成一圈,顺序排号。从第一个人开始报数(从1到3报数),凡报到3的人退出圈子,再从他的下一 8

       龙通科技有限公司笔试题

       int[] array = new int[peo];for(int i = 1;i < peo;i ){

       } for(k = 0;k < peo;k ){

       } return k 1;if(array[k] == 0){ } 4 ; ○int j = 1;while(j <= n){

       } if(○1){ } if(j == n){ } j ;3 ; ○ ; ○j--;

       }

       }

       5、在一个n×n的棋盘上,放置n个不能互相捕捉的国际象棋“皇后”的所有布局。以下是n皇后的算法,请完成填空部分:

       public class Queen {

       Queen(int d){

       } // 放置皇后的方法

       public void place(int row){

       int i = 0;if(row == n){ 1 ; ○n = d;queenPos = new int[d];private int n;private int[] queenPos;private double num = 0;// 记录共有多少种摆法

       } else { 9

       龙通科技有限公司笔试题

       } // 判断布局是否合法

       private boolean legality(int list){

       } // 测试方法

       public static void main(String[] args){

       }} System.out.println(“输入个数n:”);Scanner in = new Scanner(System.in);int n = in.nextInt();try {

       } Queen q = new Queen(n);q.place(0);System.out.println(n “*” n “时,” “共有” q.num “种可能摆法。”);System.out.println(“OK!”);e.printStackTrace();if(list == 0)

       } return true;return true;if(queenPos[i] == queenPos[list])3 ; ○for(int i = 0;i < list;i ){

       } for(i = 0;i < n;i ){

       } queenPos[row] = i;if(legality(row)); ○if(○4)return false;} catch(Exception e){ 10

第五篇:JAVA工程师笔试题

       【程序17】

       题目:猴子吃桃问题:猴子第一天摘下若干个桃子,当即吃了一半,还不瘾,又多吃了一个 第二天早上又将剩下的桃子吃掉一半,又多吃了一个。以后每天早上都吃了前一天剩下 的一半零一个。到第10天早上想再吃时,见只剩下一个桃子了。求第一天共摘了多少。public class lianxi17 { public static void main(String[] args){ int x = 1;for(int i=2;i<=10;i ){ x =(x 1)*2;} System.out.println(“猴子第一天摘了 ” x “ 个桃子”);} } 【程序18】

       题目:两个乒乓球队进行比赛,各出三人。甲队为a,b,c三人,乙队为x,y,z三人。已抽签决定比赛名单。有人向队员打听比赛的名单。a说他不和x比,c说他不和x,z比,请编程序找出三队赛手的名单。public class lianxi18 { static char[] m = { 'a', 'b', 'c' };static char[] n = { 'x', 'y', 'z' };public static void main(String[] args){ for(int i = 0;i < m.length;i ){ for(int j = 0;j < n.length;j ){ if(m[i] == 'a' && n[j] == 'x'){ continue;} else if(m[i] == 'a' && n[j] == 'y'){ continue;} else if((m[i] == 'c' && n[j] == 'x')||(m[i] == 'c' && n[j] == 'z')){ continue;} else if((m[i] == 'b' && n[j] == 'z')||(m[i] == 'b' && n[j] == 'y')){ continue;} else System.out.println(m[i] “ vs ” n[j]);} } } } 【程序19】

       题目:打印出如下图案(菱形)

       * *** ***** ******* ***** *** * public class lianxi19 { public static void main(String[] args){ int H = 7, W = 7;//高和宽必须是相等的奇数

       for(int i=0;i<(H 1)/ 2;i ){ for(int j=0;j

       题目:有一分数序列:2/1,3/2,5/3,8/5,13/8,21/13...求出这个数列的前20项之和。public class lianxi20 { public static void main(String[] args){ int x = 2, y = 1, t;double sum = 0;for(int i=1;i<=20;i ){ sum = sum (double)x / y;t = y;y = x;x = y t;} System.out.println(“前20项相加之和是: ” sum);} } 【程序21】

       题目:求1 2! 3! ... 20!的和 public class lianxi21 { public static void main(String[] args){ long sum = 0;

       long fac = 1;for(int i=1;i<=20;i ){ fac = fac * i;sum = fac;} System.out.println(sum);} } 【程序22】

       题目:利用递归方法求5!。public class lianxi22 { public static void main(String[] args){ int n = 5;rec fr = new rec();System.out.println(n “!= ” fr.rec(n));} } class rec{ public long rec(int n){ long value = 0;if(n ==1){ value = 1;} else { value = n * rec(n-1);} return value;} }

       【程序23】

       题目:有5个人坐在一起,问第五个人多少岁?他说比第4个人大2岁。问第4个人岁数,他说比第3个人大2岁。问第三个人,又说比第2人大两岁。问第2个人,说比第一个人大两岁。最后问第一个人,他说是10岁。请问第五个人多大? public class lianxi23 { public static void main(String[] args){ int age = 10;for(int i=2;i<=5;i ){ age =age 2;} System.out.println(age);} } 【程序24】 题目:给一个不多于5位的正整数,要求:

       一、求它是几位数,二、逆序打印出各位数字。//使用了长整型最多输入18位 import java.util.*;public class lianxi24 { public static void main(String[] args){ Scanner s = new Scanner(System.in);System.out.print(“请输入一个正整数:”);long a = s.nextLong();String ss = Long.toString(a);char[] ch = ss.toCharArray();int j=ch.length;System.out.println(a “是一个” j “位数。”);System.out.print(“按逆序输出是:”);for(int i=j-1;i>=0;i--){ System.out.print(ch[i]);} } } 【程序25】

       题目:一个5位数,判断它是不是回文数。即12321是回文数,个位与万位相同,十位与千位相同。

       import java.util.*;public class lianxi25 { public static void main(String[] args){ Scanner s = new Scanner(System.in);int a;do{ System.out.print(“请输入一个5位正整数:”);a = s.nextInt();}while(a<10000||a>99999);String ss =String.valueOf(a);char[] ch = ss.toCharArray();if(ch[0]==ch[4]&&ch[1]==ch[3]){ System.out.println(“这是一个回文数”);} else {System.out.println(“这不是一个回文数”);} } } //这个更好,不限位数 import java.util.*;public class lianxi25a { public static void main(String[] args){ Scanner s = new Scanner(System.in);boolean is =true;System.out.print(“请输入一个正整数:”);long a = s.nextLong();String ss = Long.toString(a);char[] ch = ss.toCharArray();int j=ch.length;for(int i=0;i

       判 else if(ch2 == 'A'){System.out.println(“Saturday”);} else {System.out.println(“无此写法!”);} };break;default:System.out.println(“无此写法!”);} } }

       class getChar{ public char getChar(){ Scanner s = new Scanner(System.in);String str = s.nextLine();char ch = str.charAt(0);if(ch<'A' || ch>'Z'){ System.out.println(“输入错误,请重新输入”);ch=getChar();} return ch;} } 【程序27】

       题目:求100之内的素数

       //使用除sqrt(n)的方法求出的素数不包括2和3 public class lianxi27 { public static void main(String[] args){ boolean b =false;System.out.print(2 “ ”);System.out.print(3 “ ”);for(int i=3;i<100;i =2){ for(int j=2;j<=Math.sqrt(i);j ){ if(i % j == 0){b = false;break;} else{b = true;} } if(b == true){System.out.print(i “ ”);} } } } //该程序使用除1位素数得2位方法,运行效率高通用性差。public class lianxi27a { public static void main(String[] args){ int[] a = new int[]{2, 3, 5, 7};for(int j=0;j<4;j )System.out.print(a[j] “ ”);boolean b =false;for(int i=11;i<100;i =2){ for(int j=0;j<4;j ){ if(i % a[j] == 0){b = false;break;} else{b = true;} } if(b == true){System.out.print(i “ ”);} } } } 【程序28】

       题目:对10个数进行排序 import java.util.*;public class lianxi28 { public static void main(String[] args){ Scanner s = new Scanner(System.in);int[] a = new int[10];System.out.println(“请输入10个整数:”);for(int i=0;i<10;i ){ a[i] = s.nextInt();} for(int i=0;i<10;i ){ for(int j=i 1;j<10;j ){ if(a[i] > a[j]){ int t = a[i];a[i] = a[j];a[j] = t;} } } for(int i=0;i<10;i ){ System.out.print(a[i] “ ”);} } } 【程序29】

       题目:求一个3*3矩阵对角线元素之和 import java.util.*;public class lianxi29 { public static void main(String[] args){ Scanner s = new Scanner(System.in);int[][] a = new int[3][3];System.out.println(“请输入9个整数:”);for(int i=0;i<3;i ){ for(int j=0;j<3;j ){ a[i][j] = s.nextInt();} } System.out.println(“输入的3 * 3 矩阵是:”);for(int i=0;i<3;i ){ for(int j=0;j<3;j ){ System.out.print(a[i][j] “ ”);} System.out.println();} int sum = 0;for(int i=0;i<3;i ){ for(int j=0;j<3;j ){ if(i == j){ sum = a[i][j];} } } System.out.println(“对角线之和是:” sum);} } 【程序30】

       题目:有一个已经排好序的数组。现输入一个数,要求按原来的规律将它插入数组中。//此程序不好,没有使用折半查找插入 import java.util.*;public class lianxi30 { public static void main(String[] args){ int[] a = new int[]{1, 2, 6, 14, 25, 36, 37,55};int[] b = new int[a.length 1];int t1 =0, t2 = 0;int i =0;Scanner s= new Scanner(System.in);System.out.print(“请输入一个整数:”);int num = s.nextInt();if(num >= a[a.length-1]){ b[b.length-1] = num;for(i=0;i= a[i]){ b[i] = a[i];} else { b[i] = num;break;} } for(int j=i 1;j

       题目:将一个数组逆序输出。import java.util.*;public class lianxi31 { public static void main(String[] args){ Scanner s = new Scanner(System.in);int a[] = new int[20];System.out.println(“请输入多个正整数(输入-1表示结束):”);int i=0,j;do{ a[i]=s.nextInt();i ;}while(a[i-1]!=-1);System.out.println(“你输入的数组为:”);for(j=0;j=0;j=j-1){ System.out.print(a[j] “ ”);} } } 【程序32】

       题目:取一个整数a从右端开始的4~7位。import java.util.*;public class lianxi32 { public static void main(String[] args){ Scanner s = new Scanner(System.in);System.out.print(“请输入一个7位以上的正整数:”);long a = s.nextLong();String ss = Long.toString(a);char[] ch = ss.toCharArray();int j=ch.length;if(j<7){System.out.println(“输入错误!”);} else { System.out.println(“截取从右端开始的” ch[j-7] ch[j-6] ch[j-5] ch[j-4]);} } } 【程序33】

       题目:打印出杨辉三角形(要求打印出10行如下图)1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 …………

       public class lianxi33 { public static void main(String[] args){ int[][] a = new int[10][10];for(int i=0;i<10;i ){ a[i][i] = 1;a[i][0] = 1;} for(int i=2;i<10;i ){ for(int j=1;j

       4~7位是:} 【程序34】

       题目:输入3个数a,b,c,按大小顺序输出。import java.util.Scanner;public class lianxi34 { public static void main(String[] args){ Scanner s = new Scanner(System.in);System.out.println(“请输入3个整数:”);int a = s.nextInt();int b = s.nextInt();int c = s.nextInt();if(a < b){ int t = a;a = b;b = t;} if(a < c){ int t = a;a = c;c = t;} if(b < c){ int t = b;b = c;c = t;} System.out.println(“从大到小的顺序输出:”);System.out.println(a “ ” b “ ” c);} } 【程序35】

       题目:输入数组,最大的与第一个元素交换,最小的与最后一个元素交换,输出数组。import java.util.*;public class lianxi35 { public static void main(String[] args){ int N = 8;int[] a = new int [N];Scanner s = new Scanner(System.in);int idx1 = 0, idx2 = 0;System.out.println(“请输入8个整数:”);for(int i=0;i max){ max = a[i];idx1 = i;} if(a[i] < min){ min = a[i];idx2 = i;} } if(idx1!= 0){ int temp = a[0];a[0] = a[idx1];a[idx1] = temp;} if(idx2!= N-1){ int temp = a[N-1];a[N-1] = a[idx2];a[idx2] = temp;} System.out.println(“n交换后的数组为:”);for(int i=0;i=m;i--){ a[i] = a[i-m];} for(int i=0;i

       题目:有n个人围成一圈,顺序排号。从第一个人开始报数(从1到3报数),凡报到3的人退出圈子,问最后留下的是原来第几号的那位。import java.util.Scanner;public class lianxi37 { public static void main(String[] args){ Scanner s = new Scanner(System.in);System.out.print(“请输入排成一圈的人数:”);int n = s.nextInt();boolean[] arr = new boolean[n];for(int i=0;i 1){ if(arr[index] == true){ countNum ;if(countNum == 3){ countNum =0;arr[index] = false;leftCount--;} } index ;if(index == n){ index = 0;} } for(int i=0;i

       题目:写一个函数,求一个字符串的长度,在main函数中输入字符串,并输出其长度。/*………………

       *……题目意思似乎不能用length()函数 */ import java.util.*;public class lianxi38 { public static void main(String[] args){ Scanner s = new Scanner(System.in);System.out.println(“请输入一个字符串:”);String str = s.nextLine();System.out.println(“字符串的长度是:” str.length());} } 【程序39】

       题目:编写一个函数,输入n为偶数时,调用函数求1/2 1/4 ... 1/n,当输入n为奇数时,调用函数1/1 1/3 ... 1/n(利用指针函数)//没有利用指针函数 import java.util.*;public class lianxi39 { public static void main(String[] args){ Scanner s = new Scanner(System.in);System.out.print(“请输入一个正整数 n= ”);int n = s.nextInt();System.out.println(“相应数列的和为:” sum(n));} public static double sum(int n){ double res = 0;if(n % 2 == 0){ for(int i=2;i<=n;i =2){ res =(double)1 / i;} } else { for(int i=1;i<=n;i =2){ res =(double)1 / i;} } return res;} } 【程序40】

       题目:字符串排序。public class lianxi40 { public static void main(String[] args){ int N=5;String temp = null;String[] s = new String[N];s[0] = “matter”;s[1] = “state”;s[2] = “solid”;s[3] = “liquid”;s[4] = “gas”;for(int i=0;i s2.charAt(i)){ result = false;break;} else if(s1.charAt(i)

       题目:809*??=800*?? 9*?? 1 其中??代表的两位数,8*??的结果为两位数,9*??的结果为3位数。求??代表的两位数,及809*??后的结果。

       //题目错了!809x=800x 9x 1 这样的方程无解。去掉那个1就有解了。public class lianxi42 { public static void main(String[] args){ int a=809,b,i;for(i=10;i<13;i ){b=i*a;if(8*i<100&&9*i>=100)System.out.println(“809*” i “=” “800*” i “ ” “9*” i “=” b);} } } 【程序43】

       题目:求0—7所能组成的奇数个数。//组成1位数是4个。//组成2位数是7*4个。//组成3位数是7*8*4个。//组成4位数是7*8*8*4个。//......public class lianxi43 { public static void main(String[] args){ int sum=4;int j;System.out.println(“组成1位数是 ” sum “ 个”);sum=sum*7;System.out.println(“组成2位数是 ” sum “ 个”);for(j=3;j<=9;j ){ sum=sum*8;System.out.println(“组成” j “位数是 ” sum “ 个”);} } } 【程序44】

       题目:一个偶数总能表示为两个素数之和。

       //由于用除sqrt(n)的方法求出的素数不包括2和3,//因此在判断是否是素数程序中人为添加了一个3。import java.util.*;public class lianxi44 { public static void main(String[] args){ Scanner s = new Scanner(System.in);int n,i;do{ System.out.print(“请输入一个大于等于6的偶数:”);n = s.nextInt();} while(n<6||n%2!=0);//判断输入是否是>=6偶数,不是,重新输入 fun fc = new fun();for(i=2;i<=n/2;i ){ if((fc.fun(i))==1&&(fc.fun(n-i)==1)){int j=n-i;System.out.println(n “ = ” i “ ” j);} //输出所有可能的素数对 } } } class fun{ public int fun(int a)//判断是否是素数的函数 { int i,flag=0;if(a==3){flag=1;return(flag);} for(i=2;i<=Math.sqrt(a);i ){ if(a%i==0){flag=0;break;} else flag=1;} return(flag);//不是素数,返回0,是素数,返回1 } } //解法二

       import java.util.*;public class lianxi44 { public static void main(String[] args){ Scanner s = new Scanner(System.in);int n;do{ System.out.print(“请输入一个大于等于6的偶数:”);n = s.nextInt();} while(n<6||n%2!=0);//判断输入是否是>=6偶数,不是,重新输入 for(int i=3;i<=n/2;i =2){ if(fun(i)&&fun(n-i)){ System.out.println(n “ = ” i “ ” (n-i));} //输出所有可能的素数对 } } static boolean fun(int a){ //判断是否是素数的函数 boolean flag=false;if(a==3){flag=true;return(flag);} for(int i=2;i<=Math.sqrt(a);i ){ if(a%i==0){flag=false;break;} else flag=true;} return(flag);} } 【程序45】

       题目:判断一个素数能被几个9整除

       //题目错了吧?能被9整除的就不是素数了!所以改成整数了。import java.util.*;public class lianxi45 { public static void main(String[] args){ Scanner s = new Scanner(System.in);System.out.print(“请输入一个整数:”);int num = s.nextInt();int tmp = num;int count = 0;for(int i = 0;tmp%9 == 0;){ tmp = tmp/9;count ;} System.out.println(num “ 能够被 ” count “ 个9整除。”);} } 【程序46】

       题目:两个字符串连接程序 import java.util.*;public class lianxi46 { public static void main(String[] args){ Scanner s = new Scanner(System.in);System.out.print(“请输入一个字符串:”);String str1 = s.nextLine();System.out.print(“请再输入一个字符串:”);String str2 = s.nextLine();String str = str1 str2;System.out.println(“连接后的字符串是:” str);} } 【程序47】

       题目:读取7个数(1—50)的整数值,每读取一个值,程序打印出该值个数的*。import java.util.*;public class lianxi47 { public static void main(String[] args){ Scanner s = new Scanner(System.in);int n=1,num;while(n<=7){ do{ System.out.print(“请输入一个1--50之间的整数:”);num= s.nextInt();}while(num<1||num>50);for(int i=1;i<=num;i ){System.out.print(“*”);} System.out.println();n ;} } } 【程序48】

       题目:某个公司采用公用电话传递数据,数据是四位的整数,在传递过程中是加密的,加密规则如下:每位数字都加上5,然后用和除以10的余数代替该数字,再将第一位和第四位交换,第二位和第三位交换。import java.util.*;public class lianxi48 { public static void main(String args[]){ Scanner s = new Scanner(System.in);int num=0,temp;do{ System.out.print(“请输入一个4位正整数:”);num = s.nextInt();}while(num<1000||num>9999);int a[]=new int[4];a[0] = num/1000;//取千位的数字 a[1] =(num/100);//取百位的数字 a[2] =(num/10);//取十位的数字 a[3] = num;//取个位的数字 for(int j=0;j<4;j ){ a[j] =5;a[j]%=10;} for(int j=0;j<=1;j ){ temp = a[j];a[j] = a[3-j];a[3-j] =temp;} System.out.print(“加密后的数字为:”);for(int j=0;j<4;j )System.out.print(a[j]);} } 【程序49】

       题目:计算字符串中子串出现的次数 import java.util.*;public class lianxi49 { public static void main(String args[]){ Scanner s = new Scanner(System.in);System.out.print(“请输入字符串:”);String str1 = s.nextLine();System.out.print(“请输入子串:”);String str2 = s.nextLine();int count=0;if(str1.equals(“")||str2.equals(”“)){ System.out.println(”你没有输入字符串或子串,无法比较!“);System.exit(0);} else { for(int i=0;i<=str1.length()-str2.length();i ){ if(str2.equals(str1.substring(i, str2.length() i)))//这种比法有问题,会把”aaa“看成有2个”aa“子串。count ;} System.out.println(”子串在字符串中出现: “ count ” 次“);} } } 【程序50】

       题目:有五个学生,每个学生有3门课的成绩,从键盘输入以上数据(包括学生号,姓名,三门课成绩),计算出平均成绩,把原有的数据和计算出的平均分数存放在磁盘文件 ”stud “中。

       import java.io.*;import java.util.*;public class lianxi50 { public static void main(String[] args){ Scanner ss = new Scanner(System.in);String [][] a = new String[5][6];for(int i=1;i<6;i ){ System.out.print(”请输入第“ i ”个学生的学号:“);a[i-1][0] = ss.nextLine();System.out.print(”请输入第“ i ”个学生的姓名:“);a[i-1][1] = ss.nextLine();for(int j=1;j<4;j ){ System.out.print(”请输入该学生的第“ j ”个成绩:“);a[i-1][j 1] = ss.nextLine();} System.out.println(”n“);} //以下计算平均分 float avg;int sum;for(int i=0;i<5;i ){ sum=0;for(int j=2;j<5;j ){ sum=sum Integer.parseInt(a[i][j]);} avg=(float)sum/3;a[i][5]=String.valueOf(avg);} //以下写磁盘文件 String s1;try { File f = new File(”C:stud“);if(f.exists()){ System.out.println(”文件存在“);}else{ System.out.println(”文件不存在,正在创建文件“);f.createNewFile();//不存在则创建 } BufferedWriter output = new BufferedWriter(new FileWriter(f));for(int i=0;i<5;i ){ for(int j=0;j<6;j ){ s1=a[i][j] ”rn“;output.write(s1);} } output.close();System.out.println(”数据已写入c盘文件stud中!");} catch(Exception e){ e.printStackTrace();} } }