题目详情
当前位置:首页 > 职业培训考试
题目详情:
发布时间:2023-11-30 18:46:26

[单项选择] 在Java语言中,如果你有下面的类定义:  Abstract class Shape{ Abstract void draw(); }  class Square extendeds Shape{} 如果你试图编译上面的代码会发生()。 
A. 一切成功编译
B. Shape可以编译,Square不能编译
C. Square可以编译,Shape不能编译
D. Shape,Square都不能编译

更多"在Java语言中,如果你有下面的类定义:  Abstract"的相关试题:

[单项选择] 在Java语言中,如果你有下面的类定义:   abstract class Shape {  abstract void draw();    }    Class Square extends Shape {}  如果你试图编译上面的代码会发生()。 
A. 一切成功编译
B. Shape可以编译,Square不能编译
C. Square可以编译,Shape不能编译
D. Shape,Square都不能编译
[单项选择] 在Java语言中,下面是main()方法的部分代码:    Frame f = new Frame("My Frame");   f.setSize(100,100);    为在屏幕显示f,应增加的代码是()。 
A. f.appear();
B. f.setForeground();
C. f.setVisible();
D. f.enable();
[单项选择] 在Java语言中,如果你有下面的类定义:abstractclassShape{ abstractvoiddraw();} ClassSquareextendsShape{} 如果你试图编译上面的代码会发生()。
A. 一切成功编译
B. Shape可以编译,Square不能编译
C. Square可以编译,Shape不能编译
D. Shape,Square都不能编译
[单项选择] 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
[单项选择] 现有:      -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):
[单项选择] 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. 编译失败
[单项选择] 研究下面的Java代码:  public class testException{  public static void main(String args[]){       int a[]={0,1,2,3,4};      int sum=0;      try{  for(int i=1;i<6;i++)  sum=sum+a[i];  System.out.println("sum="+sum);                 }      catch(ArrayIndexOutOfBoundsException ){                    System.out.println("数组越界");     }  finally{   System.out.println("程序结束");}  } }  输出结果将是()。       
A. 10  数组越界  程序结束
B. 10   程序结束
C. 数组越界  程序结束
D. 程序结束
[单项选择] 研究下面的Java代码:  switch (x) {  case 1:  System.out.println(1);  case 2:  case 3:  System.out.println(3);  case 4:  System.out.println(4); }  当x=2时,运行结果是()。 
A. 没有输出任何结果
B. 输出结果为3
C. 输出结果是3和4
D. 输出结果是1、3和4
[多项选择] 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
[多项选择] 现有如下命令行:  java -showversion ShowVersion ShowVERSION SHOWVERSION  哪三个是对的?()
A. 这是一个合法调用
B. 这是一个非法调用
C. 该调用包含一个选项
D. 该调用包含两个参数
[单项选择] 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.
[单项选择] 在Java语言中,包pack1的类class1中有成员方法:  protected void  method_1(){„},  private void method_2() {„},  public void method_3() {„}  和  void method_4() {„},  在包pack2中的类class2不是class1的子类,你在class2中可以调用方法()。 
A. method_1
B. method_2
C. method_3
D. method_4
[单项选择] 分析下列Java代码:   class A {  public static void main(String[] args)    {   method();   }      static void method()    {     try    {  System.out.println("Hello");    System.exit(0);    }    finally   {  System.out.println("good-bye");  }   }    }  编译运行后,输出结果是()。     
A. "Hello"
B. "good-bye"
C. "Hello"后面是"good-bye"
D. 代码不能编译
[单项选择] You need to create a JavaBean object that is used only within the current JSP page. It must NOT beaccessible to any other page including those that this page might import. Which JSP standard action canaccomplish this goal?()
A.
B.
C.
D.
[单项选择] 在Java语言中,小明在他的包mypackage中定义了类My_Class, 在mypackage的子包mysubpackage中也有个类My_Class。小明用 import mypackage.*;引入包, 执行其中的语句: My_Class NewClass = new My_Class();时,将发生()。 
A. 创建一个类mypackage.My_Class的对象
B. 创建一个类mypackage.mysubpackage.My_Class的对象
C. 该语句是错误的
D. 创建一个类mypackage.My_Class的对象和一个类mypackage.mysubpackage.My_Class的对象
[多项选择] You need to store a Java long primitive attribute, called customerOID, into the session scope. Which two code snippets allow you to insert this value into the session?()
A. long customerOID = 47L;session.setAttribute("customerOID", new Long(customerOID));
B. long customerOID = 47L;session.setLongAttribute("customerOID", new Long(customerOID));
C. long customerOID = 47L;session.setAttribute("customerOID", customerOID);
D. long customerOID = 47L;session.setNumericAttribute("customerOID", new Long(customerOID));
[单项选择] 分析下列java代码  Class A{  Public static void main(String[] args){  Method(); }  Static void method(){ try{  System.out.println(“hello”) }finally{  System.out.println(“good-bye”); }  } }  编译运行后,输出结果是()
A. “hello”
B. “good-bye”
C. “hello”“good-bye”
D. 代码不能编译

我来回答:

购买搜题卡查看答案
[会员特权] 开通VIP, 查看 全部题目答案
[会员特权] 享免全部广告特权
推荐91天
¥36.8
¥80元
31天
¥20.8
¥40元
365天
¥88.8
¥188元
请选择支付方式
  • 微信支付
  • 支付宝支付
点击支付即表示同意并接受了《购买须知》
立即支付 系统将自动为您注册账号
请使用微信扫码支付

订单号:

请不要关闭本页面,支付完成后请点击【支付完成】按钮
恭喜您,购买搜题卡成功
重要提示:请拍照或截图保存账号密码!
我要搜题网官网:https://www.woyaosouti.com
我已记住账号密码