单选题如果类中的成员只能被子类或同一包中的类访问,那么声明该成员时应使用下面哪个修饰符()AprivateBpackageCprotectedDpublic

单选题
如果类中的成员只能被子类或同一包中的类访问,那么声明该成员时应使用下面哪个修饰符()
A

private

B

package

C

protected

D

public


参考解析

解析: 暂无解析

相关考题:

单选题现有:   class Parser extends Utils {   public static void main(String [] args) {     System.out.print(new Parser().getInt("42"));    }   int getInt(String arg) {  return Integer.parseInt(arg);  }    }   class Utils {     int getInt(String arg) throws Exception { return 42; }    }    结果为()A 42B 编译失败。C 无输出结果。D 运行时异常被抛出。

单选题public class Employee{       private String name;  public Employee(String name){           this.name = name;      }  public void display(){         System.out.print(name);      } }  public class Manager extends Employee{       private String department;  public Manager(String name,String department){          super(name);  this.department = department;  }  public void display(){  System.out.println(super.display()+”,”+department);      } }  执行语句new Manager(“smith”,”SALES”)后程序的输出是哪项?()A smith,SALESB null,SALESC smith,nullD null,nullE 编译错误

多选题A developer is creating a class Book that needs to access class Paper.The Paper class is deployed in a JARnamedmyLib.jar.Whichthree,taken independently,will allow the developer to use the Paper class while compiling the Book class?()AThe JAR fileis located at$JAVA_HOME/jre/classes/myLib.jar.BThe JAR fileis located at$JAVA_HOME/jre/lib/ext/myLib.jar.CTheJ AR fileis located at/foo/myLib.jar and aclasspath environment variable is set that includes /foo/myLib.jar/Paper.class.DThe JAR fileis located at/foo/myLib.jar and a classpath environment variable is set that includes/foo/myLib.jar.EThe JAR file is located at/foo/myLib.jar and the Book class is compiled using javac-cp/foo/myLib.jar/Paper Book.java.FThe JAR file is located at/foo/myLib.jar and the Book class is compiled using javac-classpath/foo/myLib.jar Book.java.

多选题下面哪些代码中声明的变量可以存放10个String对象()AString[]a;BObject[]a;CString[50]a;Dchara[][];

单选题以下关于Applet的描述,哪项错误?()A 一个Applet就是一段Java程序B Applet是一种特殊的Java程序,它需要运行在Web服务器上C Applet是一种特殊的Java程序,它需要运行在Web浏览器上D Applet是一种Java SE平台的应用程序

多选题在JAVA接口中可以定义()A静态方法B常量C构造方法D抽象方法

单选题下列哪项不是Java语言的关键字?()AgotoBsizeofCinstanceofDvolatile

单选题下列代码正确的是哪项?()A public class Session implements Runnable, Clonable{   public void run ();public Object clone () ; }B public class Session extends Runnable, Cloneable {  public void run() {/*dosomething*/}       public Object clone() {/*make a copy*/} }C public abstract class Session implements Runnable, Clonable {       public void run() {/*do something*/}       public Object clone() {/*make a copy*/}        }D public class Session implements Runnable, implements Clonable {       public void run() {/*do something*/}       public Object clone() {/*make a copy*/}       }

单选题现有:  int x- reader.read();      下面哪一项正确?()A阅读器不是FileReader或者BufferedReader类型B阅读器可以是FileReader或者BufferedReaderC阅读器可以是FileReader类型,但不能是BufferedReader类型D阅读器可以是BufferedReader类型,但不能是FileReader类型

多选题java中HashTable,Vector,TreeSet,LinkedList哪些线程是安全的()。AHashTableBVectorCTreeSetDLinkedList

多选题下面有关servlet的层级结构和常用的类,说法正确的有()。AGenericServlet类:抽象类,定义一个通用的、独立于底层协议的ServletB大多数Servlet通过从GenericServlet或HttpServlet类进行扩展来实现CServletConfig接口定义了在Servlet初始化的过程中由Servlet容器传递给Servlet得配置信息对象DHttpServletRequest接口扩展ServletRequest接口,为HTTP Servlet提供HTTP请求信息

多选题下面哪些类型属于Java基本数据类型()AintBBooleanCuintDdouble

单选题以下不属于tcp连接断开的状态是()。ATIME_WAITBFIN_WAIT_1CSYNC_SENTDFIN_WAIT_2

判断题一般来说,列表框中包括的项目数都多于它能显示的数量,因此需要将列表框放到一个滚动条面板中,以便在需要时滚动。A对B错

单选题如何将一个类放到包里?()A在类的源文件开始外写上“package”关键字,后面跟包名;B在类的源文件开始外写上包名;C在类的源文件开始外写上包名,后面跟“package” 关键字;D将包名作为源文件名;

单选题1. class Animal { Animal getOne() { return new Animal(); } }  2. class Dog extends Animal {  3. // insert code here   4. }  5.  6. class AnimalTest {  7. public static void main(String [] args) {  8. Animal [] animal = { new Animal(), new Dog() } ;  9. for( Animal a : animal) {  10. Animal x = a.getOne();  11. }  12. }  13. }  和代码:  3a. Dog getOne() {  return new Dog();  }  3b. Animal getOne() {  return new Dog();  }  第 3 行中插入的哪项将编译且运行无异常?()A3a行B3b行C3a行或3b行D既非3a,也非3b

多选题下面哪些控件可以产生ActionEvent()Ajavax.swing.JButtonBjavax.swing.JTextBoxCjavax.swing.JListDjavax.swing.Timer

单选题对于移动平均算法,是计算某变量之前n个数值的算术平均,正确的说法是()。A空间复杂度是O(l)B空间复杂度是O(n)C空间复杂度是O(logn)D空间复杂度是O(nlogn)

单选题将GUI窗口中的组件按照从左到右如打字式排列的布局管理器是:()AFlowLayoutBGridLayoutCBorderLayoutDCardLayout

单选题在Java中,有哪些图形界面开发工具包?()AAWT和SwingBMFC和AWTCMFC和SwingDMFC和JFC

多选题下列哪些项是泛型的优点?()A不用向下强制类型转换B代码容易编写C类型安全D运行速度快

单选题程序员想要创建一个名为MyThread的类以便在main方法中用Thread实例化。对于下面三行:  MyThread必须继承Thread。      MyThread必须实现Thread。  MyThread必须覆盖public void run()。 有几行是正确的()A 0B 1C 2D 3

填空题JSP内置对象中,()对象是 代表应用程序上下文,它允许JSP页面与包括在同一应用程序中的任何Web组件共享信息 ,而()对象则是每个客户专用的。

单选题BufferedWriter对象中的newLine()方法的含义是哪项?()A产生换行B插入一个空行C产生回车D以上都不对

填空题在Java中,char 型采用()编码方案,这样,无论是中文字符还是英文字符,都是占用()个字节的内存空间。

单选题现有:  public class Tester {  public static void main (String[] args)  {      intx-5;  Integer xl=x;  Integer x2=x;     int x3=new Integer(5);  system..ut.print(x1.equals(x));      system..ut.print(xl==x);  system..ut.print(x2.equals(xl));      system..ut.print(x2==xl);      system..ut.print(x2==x3);  system..ut.print(x2.equals(x3));         }      }      结果为:()A编译失败BfalsefalsetruetruetruetrueCtruetruetruetruetruetrueDfalsefalsetruetruetruefalseEtruefalsetruefalsefalsetrueF运行时异常被抛出

单选题子类能否访问父类的保护级成员变量?()A可以,但仅限与读取,不能修改B可以C不能,但可以访问他继承来的保护级成员变量D不能

单选题class Test4 {   public static void main(String [] args) {   boolean x = true;   boolean y = false;   short z = 42;   if((z++ = = 42)  (y = true)) z++;   if((x = false) || (++z = = 45)) z++;   System.out.println("z = " + z);   }   }   结果为:()Az = 42Bz = 44Cz = 45Dz = 46