单选题如果类中的成员只能被子类或同一包中的类访问,那么声明该成员时应使用下面哪个修饰符()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.
单选题以下关于Applet的描述,哪项错误?()A 一个Applet就是一段Java程序B Applet是一种特殊的Java程序,它需要运行在Web服务器上C Applet是一种特殊的Java程序,它需要运行在Web浏览器上D Applet是一种Java SE平台的应用程序
单选题下列代码正确的是哪项?()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类型
多选题下面有关servlet的层级结构和常用的类,说法正确的有()。AGenericServlet类:抽象类,定义一个通用的、独立于底层协议的ServletB大多数Servlet通过从GenericServlet或HttpServlet类进行扩展来实现CServletConfig接口定义了在Servlet初始化的过程中由Servlet容器传递给Servlet得配置信息对象DHttpServletRequest接口扩展ServletRequest接口,为HTTP Servlet提供HTTP请求信息
单选题如何将一个类放到包里?()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
单选题程序员想要创建一个名为MyThread的类以便在main方法中用Thread实例化。对于下面三行: MyThread必须继承Thread。 MyThread必须实现Thread。 MyThread必须覆盖public void run()。 有几行是正确的()A 0B 1C 2D 3
单选题现有: 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运行时异常被抛出
单选题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