更多"在Java中,类Animal中的方法printA()定义如下:&ens"的相关试题:
[单项选择] 在Java中, 类Animal中的方法 printA()定义如下: public void printA() { int a = 10; int result = 10 % 3; System.out.println(result); } 在类Dog中方法printA()定义如下: public void printA() { int a = 10; System.out.println( a / 3 ); } Dog类的定义如下: class Dog extends Animal{…}. Animal animal = new Dog(); animal.printA(); 以上语句输出为()。
A. 0
B. 1
C. 2
D. 3
E. 3.3333
[单项选择] 在Java中,类Animal中的方法printA()定义如下: public void printA() { Int a=10; Int result =10%3; System.out.println(result); } 在类Dog中方法printA()定义如下: public void printA() { Int a=10; System.out.println(a/3); } Dog类的定义如下: Class Dog extends Animal{…}. Animal animal=new Dog(); animal.printA(); 以上语句输出结果为()。
A. 0
B. 1
C. 2
D. 3
E. 3.3333
[单项选择] 在Java中, 类Animal中的方法printA()定义如下: publicvoidprintA(){ inta=10; intresult=10%3; System.out.println(result);} 在类Dog中方法printA()定义如下: publicvoidprintA(){ inta=10; System.out.println(a/3);} Dog类的定义如下: classDogextendsAnimal{…}.Animalanimal=newDog();animal.printA(); 以上语句输出为()。
A. 0
B. 1
C. 2
D. 3
E. 3.3333
[单项选择] In a Java EE messaging application, one MDB is consuming a lot of memory at high traffic. What configuration should you use to prevent possible out-of-memory error at high traffic and at the same time not losing messages?()
A. Configure a Work Manager for the MDB with a Maximum Thread Constraint.
B. Configure a Work Manager for the MDB with a Minimum Thread Constraint.
C. Configure a Work Manager for the MDB with a Maximum Thread Constraint and a Capacity Constraint.
D. Configure a Work Manager for the MDB with a Minimum Thread Constraint and a Capacity Constraint.
E. Configure a Work Manager for the MDB with both a Maximum Thread Constraint and Minimum Thread Constraint.
[多项选择] You deployed a Java EE Shared Library and want to use it from an application that is also deployed on the same cluster. Which two manifest attributes must be specified at a minimum with corresponding values in the deployment descriptor of the application that requires?()
A. Implementation-Version
B. Specification-Version
C. Extension-Name
D. Specification-Vendor
E. Implementation-Vendor
[多项选择] 现有如下命令行: java -showversion ShowVersion ShowVERSION SHOWVERSION 哪三个是对的?()
A. 这是一个合法调用
B. 这是一个非法调用
C. 该调用包含一个选项
D. 该调用包含两个参数
[单项选择] class java { public static void main(String [] java) { for (int Java = 1; Java 〈 java.length; Java++) System.out.print("java "); } } 和命令行: java java java java java 结果为:()
A. java
B. java java
C. java java java
D. 编译失败
[单项选择] 现有: -f是一个对java .io.File实例的合法引用 - fw足‘个对java.io.FileWriter实例的合法引用 - bw足一个对java.io.BufferedWriter实例的合法引用 以下哪一项无效?()
A. PrintWriter prtWtr = new PrintWriter (f);
B. PrintWriter prtWtr = new PrintWriter( fw);
C. PrintWriter prtWtr = new PrintWriter(bw):
D. BufferWriter bufWtr = new BufferedWritr(f);
E. BufferWriter bufWtr = new BufferedWriter(fw);
F. BufferWriter bufWtr = new BufferedWriter (bw):
[单项选择] 定义枚举如下: public enum Direction{ EAST,SOUTH,WEST,NORTH } 下列正确使用该枚举类型的语句是哪项?()
A. Direction Direction=EAST;
B. Direction direction=Direction.WEST;
C. int a- Direction.NORTH;
D. Direction direction=2;
[单项选择] ClassOne.java package com.abc.pkg1; public class ClassOne { private char var = ‘a‘; char getVar() {return var;} } ClassTest.java package com.abc.pkg2; import com.abc.pkg1.ClassOne; public class ClassTest extends ClassOne { public static void main(Stringargs) { char a = new ClassOne().getVar(); char b = new ClassTest().getVar(); } } What is the result?()
A. Compilation will fail.
B. Compilation succeeds and no exceptions are thrown.
C. Compilation succeeds but an exception is thrown at line 5 in ClassTest.java.
D. Compilation succeeds but an exception is thrown at line 6 in ClassTest.java.
[单项选择] 在J2EE中,有如下代码在Servlet1.Java中 Import javax.servlet.*; Import javax.servlet.http.* Import java.io.IOException; Import java.io.PrintWriter; Public class Servlet1 extends HttpServlet{ Public void init () throw ServletException {} Public void service(HttpServletRequest request, HttpServletResponce response) throws ServletException,IOException{ PrintWriter out=response.getWriter(); Out.println(“hello!”); } } 假如编译Servlet要具备的环境都已经建立好。现在用完全正确的命令编译该文件,对于以下成熟正确的是()
A. 编译该晚间时会提示缺少doGe()t或者doPost(),编译不能够成功通过
B. 编译后,把Serlvet.cass放在正确的位置,在浏览器中查看该Servlet1,会看到输出文在:“hello!”
C. 编译后,把Servlet.class放在正确的位置,在浏览器中查看该Servlet1,却看不到任何输出的文字
D. 编译后,把Servlet.class放在正确的位置,在浏览器中查看该Servlet1,却看到产生运行时错误的出错信息
[单项选择] 编译如下的Java程序片段: Class test{ Int count=9; Public void a(){ Int count=10; System.out,println(“count 1=” + count); } Public void count(){ System.out.println(“count 2 =”+ count); } Public static void main(String args[] ){ Test t=new Test(); t.a(); t.count(); } } 结果是()
A. 不能通过编译
B. 输出:count 1 =10 count 2=9
C. 输出:count 1=9 count 2=9
[单项选择] ClassOne.java 1. package com.abc.pkg1; 2. public class ClassOne { 3. private char var = ‘a’; 4. char getVar() {return var;} 5. } ClassTest.java 1. package com.abc.pkg2; 2. import com.abc.pkg1.ClassOne; 3. public class ClassTest extends ClassOne { 4. public static void main(String[]args) { 5. char a = new ClassOne().getVar(); 6. char b = new ClassTest().getVar(); 7. } 8. } What is the result?()
A. Compilation will fail.
B. Compilation succeeds and no exceptions are thrown.
C. Compilation succeeds but an exception is thrown at line 5 in ClassTest.java.
D. Compilation succeeds but an exception is thrown at line 6 in ClassTest.java.
[单项选择] 现有如下类型: a - java.util.Hashtable b - java.util.List c - java.util.ArrayList d - java.util.SortedSet 和定义: 1 – 使用本接口,允许用户控制集合中每个元素的插入位置。 2 – 使用本集合,确保用户可以按照递增或元素的自然顺序遍历集合。 3 – 本具体类型允许空元素及基于索引的访问。 4 – 本集合是同步的。 哪一组匹配是对的?()
A. 1 描述 b; 3 描述 c。
B. 2 描述 d; 3 描述 b。
C. 3 描述 a; 4 描述 b。
D. 4 描述 a; 2 描述 c。
[多项选择] Given a file GrizzlyBear.java: 1. package animals.mammals; 2. 3. public class GrizzlyBear extends Bear { 4. void hunt() { 5. Salmon s = findSalmon(); 6. s.consume(); 7. } 8. } and another file, Salmon.java: 1. package animals.fish; 2. 3. public class Salmon extends Fish { 4. void consume() { /* do stuff */ } 5. } Assume both classes are defined in the correct directories for theft packages, and that the Mammal class correctly defines the findSalmon() method. Which two changes allow this code to compile correctly?()
A. add public to the start of line 4 in Salmon.java
B. add public to the start of line 4 in GrizzlyBear.java
C. add import animals.mammals.*; at line 2 in Salmon.java
D. add import animals.fish.*; at line 2 in GrizzlyBear.java
E. add import animals.fish.Salmon.*; at line 2 in GrizzlyBear.java
F. add import animals.mammals.GrizzlyBear.*;at line 2 in Salmon.java
[简答题] 内存缓冲区BUFFER定义如下,按照要求,写出指令序列 BUFFER DB 20 DUP(?) (1)将缓冲区全部置为0,并使执行时间最短。 (2)将缓冲区全部置为空格字符(ASCII代码20H),使用的指令条数最少 (3)将缓冲区各字节依次设置为0,1,2,3,4,……,19 (4)将缓冲区各字节依次设置为0,-1,-2,-3,-4,……,-19 (5)将缓冲区各字节依次设置为30,29,28,27,……,11 (6)将缓冲区各字节依次设置为0,2,4,6,8,……,38 (7)将缓冲区各字节依次设置为0,1,2,3,0,1,2,3,…,3
[单项选择] 在J2EE中,某一java程序中有如下代码: DataInputStream din = new DataInputStream(new BufferedInputStream (new FileInputStream("employee.dat"))); System.out.print(din.readByte()); 假设在employee.dat文件中只有如下一段字符:abcdefg。则:System.out在屏幕上打印( )。
A. a
B. b
C. 97
D. 98
[单项选择] 在j2ee中,某一Java程序中有如下代码: DataInputStream din =new DataInputStream(new BufferedInputStream(new FileInputStream("employee.dat"))); System.out.print(din.readByte()); 假设在employee.dat文件中只有如下一段字符:abcdefg.则:System.out在屏幕上打印()
A. a
B. b
C. 97
D. 98