多选题在J2EE中,假如在当前目录下不存在employee.txt文件。在当前目录下的一个类文 件的main函数只包含如下代码: try{                //1   PrintWriter out =new  PrintWriter(new FileOutputStream(“employee.txt”));  //2    String name = “jb-aptech”;           //3    double salary = 75000;            //4  

题目
多选题
在J2EE中,假如在当前目录下不存在employee.txt文件。在当前目录下的一个类文 件的main函数只包含如下代码: try{                //1   PrintWriter out =new  PrintWriter(new FileOutputStream(“employee.txt”));  //2    String name = “jb-aptech”;           //3    double salary = 75000;            //4    out.print(name);             //5    out.print(“ ”);             //6    out.println(salary);             //7  }                //8   catch(Exception e)  {           //9   System.out.println(“文件没有发现!”);         //10  }                 //11  在DOS控制台上编译并且运行该类文件。下面的描述正确的是()。
A

使用java命令运行该类文件,将在控制台上打印:”文件没有发现!”

B

运行结束后打开employee.txt,会发现该类文件什么也没有

C

运行结束打开employee.txt,会发现文件中有这样的文本:“jb-aptech 75000”

D

在第7行后加上:out.close(),编译并运行该文件后,打开employee.txt,会发现文件中有这样的文本:“jb-aptech 75000.0”

E

把第2行代码改为:PrintWriter out = PrintWriter(new File


相似考题

3.请完成程序,首先由一个类simple实现Serializable接口,并有三个成员变量,分别为int型、double型和String型,可以用toString的方法显示这三个成员变量。在main方法中创建这个simple的持久对象,根据用户在命令行输入的三个参数来设定其中成员变量的值。然后,将这个对象写入名为TheSerial.data的文件中,并显示成员变量。最后从文件TheSerial.data中读出三个成员变量并显示出来。注意:请勿修改main()主方法和其他已有语句内容,仅在横线处填入适当语句。import java.io.*;class TheSerial implements Serializable{private int intvalue;private double doublevalue;private String string;The Serial (){intvalue=123;doublevalue=12.34;string="Serialize Test";}public void setDouble(double d){doublevalue=d;}public void setInt(int i){intvalue=i;}public void setString(String s){string=s;}public String to String(){return("int="+intvalue+" double="+doublevalue+" string="+string);}}public class simple{public static void main(String[] args){The Serial e1=new TheSerial();TheSerial e2;try{e1.setInt(Integer.parseInt(args[0]));e1.setDouble(Double.parseDouble(args[1]));e1.setString(args[2]);}catch(Exception e){e1.setString(e.getMessage());}System.out.println(e1);try{FileOutputStream S=new FileOutputStream("TheSerial.data");ObjectOutputStream OS=new ObjectOutputStream(oS);______;}catch(IOException ioException){System.out.println (ioException.getMessage ());}try{FileInputStream iS=new FileInputStream("TheSerial.data");ObjectInputStream IS=new ObjectInputStream(iS);______;System.out.println(e2);}catch(IOException ioException){System.out.println(ioException.getMessage());}catch(ClassNotFoundException cnfException){System.out.println(cnfException.getMessage());}}}

更多“多选题在J2EE中,假如在当前目录下不存在employee.txt文件。在当前目录下的一个类文 件的main函数只包含如下代码: try{                //1   PrintWriter out =new  PrintWriter(new FileOutputStream(“employee.txt”));  //2    String name = “jb-aptech”;           //3    double salary = 75000;            //4  ”相关问题
  • 第1题:

    阅读以下说明和Java代码,将应填入(n)处的字句写在对应栏内。

    [说明]

    本程序的功能是给公司的员工Tom,Jack,Green增加薪水。三人的职位分别是programmer, Manager,CEO。

    程序由6个类组成:WorkerTest是主类,programmer,Manager,CEO三个类,薪水增加的规则是 programmer的涨幅是5%;Manager的是10%;CEO也是Manager,但是它除了有Manager的涨幅,还有1000元的bonus。接口SalaryRaise提供了一个增加薪水的方法raise()。

    [java程序]

    public class WorkerTest {

    public WorkerTest( ) {}

    public static void main( String[] args) {

    Programmer programmer = new Programmer( "Tom" ,3000);

    Manager manager = new Manager( "Jack" ,4000);

    CEO ceo = new CEO( "Green" ,4000);

    Worker [] worker = new Worker[3];

    programmer, raise( );

    manager, raise( );

    ceo. raise( );

    worker[0] = programmer;

    worker [1] = manager;

    worker[2] = ceo;

    for ( int i = 0 ;i < worker, length; i + + ) {

    System. out. prinfln (" Name:" + worker [i]. getName ( ) +" \ tSalary:" + worker [i]. getSalary ());

    public interface SalaryRaise { void raise( ); }

    public class Worker {

    public String name;

    public double (1);

    public Worker( ) {}

    public String getName( ) {return name;}

    public void setName( String name) {this. name = name;}

    public double getSalary( ) {return salary;}

    public void setSalary(double salary) { this. salary = salary; }

    }

    public class Programmer extends Worker implements (2) {

    public Programmer( ) {}

    public void raise( ) {

    double pets=0.05;

    double sala = this. getSalary( ) * (1 + pers);

    this. setSalary (sala);

    public Programmer( Siring name, double salary) t

    this. name = name;

    this. salary = salary;

    public class Manager extends (3) implements SalaryRaise {

    public Manager( ) { }

    public Manager(String name, double salary) {

    this. name = name;

    this. salary = salary;

    }

    public void raise( ) {

    double pets = 0.1;

    double sala = this. getSalary() * (1 + pers);

    this. setSalary(sala);

    }

    }

    public class CEO extends Manager implements SalaryRaise {

    public CEO() {}

    public CEO( String name,double salary) {

    this. name = name;

    this. salary = salary;

    }

    public void raise( ) {

    double bonus = 1000;

    (4);

    double sala = this. getSalary( );

    (5);

    this. setSalary(sala);

    }

    }


    正确答案:(1)salary (2)SalaryRalse (3)Worker (4) super. raise() (5)sala+=bonus及其等效形式
    (1)salary (2)SalaryRalse (3)Worker (4) super. raise() (5)sala+=bonus及其等效形式 解析:(1)从Worker这个类的结构来看,它有两个属性ufinle和salary,因此这里应该填salary;
    (2)~(3):很显然Programmer类和Manager类继承于 Worker类和SalaryRaise接口。
    (4)~(5):CEO类继承于Manager类,而根据题意, CEO除了有Managor的涨幅,还有1000元的bonus。所以,CEO薪水的涨幅可以使用基类相同的方法super. raise(),然后再加上奖金sala+=bonus即可。

  • 第2题:

    在J2EE中,加入在当前目录下不存在employee.txt文件。在当前目录下的一个类文件的 main函数只包含如下代码:  try{                //1    PrintWriter out=new PrintWriter(new FileOutputStream(“employee.txt”));//2    String name=”jb-aptech”;          //3    double salary=75000;           //4    out.print(name);            //5    out.print(„  „);            //6    out,print(salary);            //7  }                //8  catch(Exception e) {            //9    System.out.println(“文件没有被发现!”);       //10  }                //11  在DOS控制台上编译并运行该类文件。下面描述正确的是()。 

    • A、使用java命令运行该类文件,将在控制台上打印:”文件没有发现!”;
    • B、运行结束后打开employee.txt,会发现该文件什么都没有
    • C、运行结束后打开employee.txt,会发现该文件中有这样的文本:”jb-aptech 75000”
    • D、在第7行后加上代码:out.close (),编译并运行后,打开打开employee.txt,才会发现该文件中有这样的文本:”jb-aptech 75000.0”

    正确答案:B,D

  • 第3题:

    在J2EE中,利用下列构造函数准备对文件abc.txt操作,但文件abc.txt在当前目录不存在,不会产生运行时错误的是()。 

    • A、BufferedReader  breader=new BufferedReader(new FileReader("abc.txt"));
    • B、PrintWriter out = new PrintWriter(new FileWriter(“abc.txt”),true);
    • C、FileInputStream fin = new FileInputStream(“abc.txt”);
    • D、OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(“abc.txt”));

    正确答案:B,D

  • 第4题:

    //point X  public class foo (  public static void main (String[]args) throws Exception {  printWriter out = new PrintWriter (new  java.io.outputStreamWriter (System.out), true;  out.printIn(“Hello”);  }  )   Which statement at PointX on line 1 allows this code to compile and run?()  

    • A、 Import java.io.PrintWriter;
    • B、 Include java.io.PrintWriter;
    • C、 Import java.io.OutputStreamWriter;
    • D、 Include java.io.OutputStreamWriter;
    • E、 No statement is needed.

    正确答案:A

  • 第5题:

    在J2EE中,假如在当前目录下不存在employee.txt文件。在当前目录下的一个类文 件的main函数只包含如下代码: try{                //1   PrintWriter out =new  PrintWriter(new FileOutputStream(“employee.txt”));  //2    String name = “jb-aptech”;           //3    double salary = 75000;            //4    out.print(name);             //5    out.print(“ ”);             //6    out.println(salary);             //7  }                //8   catch(Exception e)  {           //9   System.out.println(“文件没有发现!”);         //10  }                 //11  在DOS控制台上编译并且运行该类文件。下面的描述正确的是()。 

    • A、使用java命令运行该类文件,将在控制台上打印:”文件没有发现!”
    • B、运行结束后打开employee.txt,会发现该类文件什么也没有
    • C、运行结束打开employee.txt,会发现文件中有这样的文本:“jb-aptech 75000”
    • D、在第7行后加上:out.close(),编译并运行该文件后,打开employee.txt,会发现文件中有这样的文本:“jb-aptech 75000.0”
    • E、把第2行代码改为:PrintWriter out = PrintWriter(new File

    正确答案:B,D

  • 第6题:

    //point X   public class foo {  public static void main (Stringargs) throws Exception {   java.io.printWriter out = new java.io.PrintWriter {   new java.io.outputStreamWriter (System.out), true;   out.printIn(“Hello”);   }   } }   Which statement at PointX on line 1 allows this code to compile and run?()  

    • A、 Import java.io.*;
    • B、 Include java.io.*;
    • C、 Import java.io.PrintWriter;
    • D、 Include java.io.PrintWriter;
    • E、 No statement is needed.

    正确答案:E

  • 第7题:

    //point X    public class foo (   public static void main (Stringargs) throws Exception {   printWriter out = new PrintWriter (new )  java.io.outputStreamWriter (System.out), true;   out.printIn(“Hello”);    }   )   Which statement at PointX on line 1 allows this code to compile and run?()

    • A、 Import java.io.PrintWriter;
    • B、 Include java.io.PrintWriter;
    • C、 Import java.io.OutputStreamWriter;
    • D、 Include java.io.OutputStreamWriter;
    • E、 No statement is needed.

    正确答案:A

  • 第8题:

    多选题
    在J2EE中,加入在当前目录下不存在employee.txt文件。在当前目录下的一个类文件的 main函数只包含如下代码:  try{                //1    PrintWriter out=new PrintWriter(new FileOutputStream(“employee.txt”));//2    String name=”jb-aptech”;          //3    double salary=75000;           //4    out.print(name);            //5    out.print(„  „);            //6    out,print(salary);            //7  }                //8  catch(Exception e) {            //9    System.out.println(“文件没有被发现!”);       //10  }                //11  在DOS控制台上编译并运行该类文件。下面描述正确的是()。
    A

    使用java命令运行该类文件,将在控制台上打印:”文件没有发现!”;

    B

    运行结束后打开employee.txt,会发现该文件什么都没有

    C

    运行结束后打开employee.txt,会发现该文件中有这样的文本:”jb-aptech 75000”

    D

    在第7行后加上代码:out.close (),编译并运行后,打开打开employee.txt,才会发现该文件中有这样的文本:”jb-aptech 75000.0”


    正确答案: B,C
    解析: 暂无解析

  • 第9题:

    多选题
    在J2EE中,假如在当前目录下不存在employee.txt文件。在当前目录下的一个类文件的main函数只包含如下代码:  try {                                                             PrintWriter out = new PrintWriter(new FileOutputStream(“employee.txt”));      String name = “jb-aptech”;                                    double salary = 75000;                                            out.print(name);                                                out.print(„ „);                                                out.println(salary);                                        }                                                              catch(Exception e)                                               System.out.println("文件没有发现!");                                                        在DOS控制台上编译并且运行该类文件。下面的描述正确的是()。
    A

    使用java命令运行该类文件,将在控制台上打印:文件没有发现!

    B

    运行结束后打开employee.txt,会发现该文件什么也没有

    C

    运行结束后打开employee.txt,会发现文件中有这样的文本:“jb-aptech 75000”

    D

    在第7行后加上代码:out.close(),编译并运行该类文件后,打开employee.txt,才会发现文件中有这样的文本:“jb-aptech 75000.0”

    E

    把第2行代码改为: PrintWriter out = new PrintWriter(new FileOutputStream(“employee.txt”),true);  编译并运行该类文件后,打开employee.txt,才会发现文件中有这样的文本:“jb-aptech 75000.0”


    正确答案: D,B
    解析: 暂无解析

  • 第10题:

    单选题
    在J2EE中,Servlet1的代码如下:  import javax.servlet.*;  import javax.servlet.http.*; import java.io.*;  public class Servlet1 extends HttpServlet {  public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {      response.setContentType("text/html");      PrintWriter out = response.getWriter();      String aa=request.getQueryString();      String bb=request.getMethod();      out.println(aa);  out.println(bb);   } }  把Servlet1.class文件放在Web服务器适合的目录下,在浏览B器地址栏内输入:http://localhost:8080/servlet/Servlet1?name=jb-aptech&phone=12345678,看到的结果是()。
    A

    name=jb-aptech&phone=12345678 GET

    B

    name=jb-aptech,phone=12345678 GET

    C

    jb-aptech,12345678 POST

    D

    name,phone GET

    E

    2,POST


    正确答案: A
    解析: 暂无解析

  • 第11题:

    单选题
    //point X  public class foo { public static void main (String[]args) throws Exception {  java.io.printWriter out = new java.io.PrintWriter {  new java.io.outputStreamWriter (System.out), true;  out.printIn(“Hello”); }  }  }   Which statement at PointX on line 1 allows this code to compile and run?()
    A

     Import java.io.*;

    B

     Include java.io.*;

    C

     Import java.io.PrintWriter;

    D

     Include java.io.PrintWriter;

    E

     No statement is needed.


    正确答案: A
    解析: 暂无解析

  • 第12题:

    单选题
    在J2EE中,如果去编译并运行下面的代码,在这里假定在当前目录下没有Hello.txt文件: import java.io.*;  public class Mine {  public static void main(String argv[]){      Mine m=new Mine();  System.out.println(m.amethod());   }  public int amethod() {     try {  FileInputStream dis=new FileInputStream("Hello.txt");  }  catch (FileNotFoundException fne) {  System.out.println("No such file found");          return -1;     }  catch(IOException ioe)  { }     finally {  System.out.println("Doing finally");     }  return 0;   } }  结果会输出()。
    A

    No such file found

    B

    No such file found -1

    C

    No such file found doing finally -1

    D

    0


    正确答案: C
    解析: 暂无解析

  • 第13题:

    请完成以下程序,首先由一个类Example2_3实现Serializable接口,并有三个成员变量,分别为int型、double型和String型,可以用toString的方法显示这三个成员变量。在main方法中创建这个Example2_3的持久对象,根据用户在命令行输入的三个参数来设定其中成员变量的值。然后,将这个对象写入名为TheSerial.data的文件,并显示成员变量。最后从文件TheSerial.data中读出三个成员变量并显示出来。

    注意:请勿改动main()主方法和其他已有语句内容,仅在横线处填入适当语句。

    import java.io.*;

    class TheSerial implements Serializable

    {

    private int intValue;

    private double doubleValue;

    private String string;

    TheSerial()

    {

    intValue = 123;

    doubleValue = 12.34;

    string = "Serialize Test";

    }

    public void setDouble(double d)

    {

    doubleValue = d;

    }

    public void setInt(int i)

    {

    intValue = i;

    }

    public void setString(String s)

    {

    string = s;

    }

    public String toString()

    {

    return("int="+intValue+"double="+doubleValue+" string="+string);

    }

    }

    public class Example2_3

    {

    public static void main(String argv[])

    {

    TheSerial e1 = new TheSerial();

    TheSerial e2;

    try

    {

    e1.setInt(Integer.parseInt(argv[0]));

    e1.setDouble(Double.parseDouble(argv[1]));

    e1.setString[argv[2]);

    }

    catch(Exception e)

    {

    e1.setString(e.getMessage{));

    }

    System.out.println(e1);

    try

    {

    FileOutputStream S = new FileOutputStream("TheSerial.data");

    ObjectOutputStream IS = new ObjectOutputStream(oS);

    ______;

    }

    catch(IOException ioException)

    {

    System.out.println(ioException.getMessage());

    }

    try

    {

    FileInputStream iS = new FileInputStream("TheSerial. data");

    ObjectInputStream IS = new ObjectInputStream(iS);

    ______

    System.out.println(e2);

    }

    catch(IOException ioException)

    {

    System.out.println(ioException.getMessage());

    }

    catch(ClassNotFoundException cnfException)

    {

    System.out.println(cnfException.getMessage());

    }

    }

    }


    正确答案:①oOS.writeObject(e1) ②e2=(TheSerial)oIS.readObject()
    ①oOS.writeObject(e1) ②e2=(TheSerial)oIS.readObject() 解析:本题主要考查串行化相关的方法和实现。解题中首先要掌握串行化的基本过程和反串行化的过程。串行化过程首先要创建一个输出流FileOutputStream,通过该类的实例对文件进行访问,然后创建一个ObJectOutput Stream对象,通过writeObject()方法来实现对象的序列化。第一个空就是使用writeObject()实现序列化。
    反序列化过程中用FileInputStream对象建立读取文件的连接,并使用该对象创建一个 ObiectInputStream的实例,这个ObjectInput Stream实例的readObject()方法就可以实现对象的反序列化。第二个空就是使用readObject()实现反序列化。

  • 第14题:

    在J2EE中,假如在当前目录下不存在employee.txt文件。在当前目录下的一个类文件的main函数只包含如下代码:  try {                                                             PrintWriter out = new PrintWriter(new FileOutputStream(“employee.txt”));      String name = “jb-aptech”;                                    double salary = 75000;                                            out.print(name);                                                out.print(„ „);                                                out.println(salary);                                        }                                                              catch(Exception e)                                               System.out.println("文件没有发现!");                                                        在DOS控制台上编译并且运行该类文件。下面的描述正确的是()。 

    • A、使用java命令运行该类文件,将在控制台上打印:"文件没有发现!"
    • B、运行结束后打开employee.txt,会发现该文件什么也没有
    • C、运行结束后打开employee.txt,会发现文件中有这样的文本:“jb-aptech 75000”
    • D、在第7行后加上代码:out.close(),编译并运行该类文件后,打开employee.txt,才会发现文件中有这样的文本:“jb-aptech 75000.0”
    • E、把第2行代码改为: PrintWriter out = new PrintWriter(new FileOutputStream(“employee.txt”),true);  编译并运行该类文件后,打开employee.txt,才会发现文件中有这样的文本:“jb-aptech 75000.0”

    正确答案:B,D,E

  • 第15题:

    在J2EE中,Servlet1的代码如下:  import javax.servlet.*;  import javax.servlet.http.*; import java.io.*;  public class Servlet1 extends HttpServlet {  public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {      response.setContentType("text/html");      PrintWriter out = response.getWriter();      String aa=request.getQueryString();      String bb=request.getMethod();      out.println(aa);  out.println(bb);   } }  把Servlet1.class文件放在Web服务器适合的目录下,在浏览B器地址栏内输入:http://localhost:8080/servlet/Servlet1?name=jb-aptech&phone=12345678,看到的结果是()。 

    • A、name=jb-aptech&phone=12345678 GET
    • B、name=jb-aptech,phone=12345678 GET
    • C、jb-aptech,12345678 POST
    • D、name,phone GET
    • E、2,POST

    正确答案:A

  • 第16题:

    在J2EE中,如果去编译并运行下面的代码,在这里假定在当前目录下没有Hello.txt文件: import java.io.*;  public class Mine {  public static void main(String argv[]){      Mine m=new Mine();  System.out.println(m.amethod());   }  public int amethod() {     try {  FileInputStream dis=new FileInputStream("Hello.txt");  }  catch (FileNotFoundException fne) {  System.out.println("No such file found");          return -1;     }  catch(IOException ioe)  { }     finally {  System.out.println("Doing finally");     }  return 0;   } }  结果会输出()。 

    • A、No such file found
    • B、No such file found -1
    • C、No such file found doing finally -1
    • D、0

    正确答案:C

  • 第17题:

    //point X  public class foo { public static void main (String[]args) throws Exception {  java.io.printWriter out = new java.io.PrintWriter {  new java.io.outputStreamWriter (System.out), true;  out.printIn(“Hello”); }  }  }   Which statement at PointX on line 1 allows this code to compile and run?()  

    • A、 Import java.io.*;
    • B、 Include java.io.*;
    • C、 Import java.io.PrintWriter;
    • D、 Include java.io.PrintWriter;
    • E、 No statement is needed.

    正确答案:E

  • 第18题:

    class Waiting implements Runnable {  boolean flag = false;  public synchronized void run() {  if (flag) {  flag = false;  System.out.print("1 ");  try { this.wait(); } catch (Exception e) { }  System.out.print("2 ");  }  else {  flag = true;  System.out.print("3 ");  try { Thread.sleep(2000); } catch (Exception e) { }  System.out.print("4 ");  notify();  }  }  public static void main(String [] args) {  Waiting w = new Waiting();  new Thread(w).start();  new Thread(w).start ();  }  }  以下哪两项是正确的?() 

    • A、代码输出 1 3 4
    • B、代码输出 3 4 1
    • C、代码输出 1 2 3 4
    • D、代码不会完成

    正确答案:A,B

  • 第19题:

    多选题
    在J2EE中,利用下列构造函数准备对文件abc.txt操作,但文件abc.txt在当前目录不存在,不会产生运行时错误的是()。
    A

    BufferedReader  breader=new BufferedReader(new FileReader(abc.txt));

    B

    PrintWriter out = new PrintWriter(new FileWriter(“abc.txt”),true);

    C

    FileInputStream fin = new FileInputStream(“abc.txt”);

    D

    OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(“abc.txt”));


    正确答案: C,A
    解析: 暂无解析

  • 第20题:

    多选题
    class Waiting implements Runnable {  boolean flag = false;  public synchronized void run() {  if (flag) {  flag = false;  System.out.print("1 ");  try { this.wait(); } catch (Exception e) { }  System.out.print("2 ");  }  else {  flag = true;  System.out.print("3 ");  try { Thread.sleep(2000); } catch (Exception e) { }  System.out.print("4 ");  notify();  }  }  public static void main(String [] args) {  Waiting w = new Waiting();  new Thread(w).start();  new Thread(w).start ();  }  }  以下哪两项是正确的?()
    A

    代码输出 1 3 4

    B

    代码输出 3 4 1

    C

    代码输出 1 2 3 4

    D

    代码不会完成


    正确答案: A,C
    解析: 暂无解析

  • 第21题:

    多选题
    现有:  class Waiting implements Runnable  {       boolean flag=false;  public  synchronized void run()  {       if  (flag)  {       flag=false;  System.out.print ("1");  try  {  this.wait();  )  catch  (Exception e)  {  }       System.out.print ("2");       }  else  {       flag=true;  System.out.print ("3");  try{Thread.sleep (2000); } catch(Exception e)  {}      System.out.print ("4");       notify();       }       }  public static void main (String  []  args)  {       Waiting w=new Waiting();       new Thread (w) .start();       new Thread (w) .start();       }       }  以下哪两项是正确的?()
    A

    代码输出l 3 4

    B

    代码输出3 4 1

    C

    代码输出l 2 3 4

    D

    代码输出1 3 4 2

    E

    代码运行完毕

    F

    代码不会完成


    正确答案: D,B
    解析: 暂无解析

  • 第22题:

    单选题
    //point X   public class foo {  public static void main (Stringargs) throws Exception {   java.io.printWriter out = new java.io.PrintWriter {   new java.io.outputStreamWriter (System.out), true;   out.printIn(“Hello”);   }   } }   Which statement at PointX on line 1 allows this code to compile and run?()
    A

     Import java.io.*;

    B

     Include java.io.*;

    C

     Import java.io.PrintWriter;

    D

     Include java.io.PrintWriter;

    E

     No statement is needed.


    正确答案: D
    解析: 暂无解析

  • 第23题:

    多选题
    在J2EE中,假如在当前目录下不存在employee.txt文件。在当前目录下的一个类文件的main函数只包含如下代码: try{//1 PrintWriterout=newPrintWriter(newFileOutputStream(“employee.txt”));//2 Stringname=“jb-aptech”;//3 doublesalary=75000;//4 out.print(name);//5 out.print(‘‘);//6 out.println(salary);//7 }//8 catch(Exceptione)//9 System.out.println("文件没有发现!");//10 在DOS控制台上编译并且运行该类文件。下面的描述正确的是()。
    A

    使用java命令运行该类文件,将在控制台上打印:文件没有发现!

    B

    运行结束后打开employee.txt,会发现该文件什么也没有

    C

    运行结束后打开employee.txt,会发现文件中有这样的文本:“jb-aptech75000”

    D

    在第7行后加上代码:out.close(),编译并运行该类文件后,打开employee.txt,才会发现文件中有这样的文本:“jb-aptech75000.0”

    E

    把第2行代码改为:PrintWriterout=newPrintWriter(newFileOutputStream(“employee.txt”),true);编译并运行该类文件后,打开employee.txt,才会发现文件中有这样的文本:“jb-aptech75000.0”


    正确答案: E,D
    解析: 暂无解析