class First { public First() { aMethod(); bMethod(); } private void aMethod() { System.out.println("A:in First class"); } public void bMethod() { System.out.println("B:in First class"); }}public class Second extends First { public Second() { aMethod(); bMethod(); } public void aMethod() { System.out.println("A:in Second class"); } public void bMethod() { System.out.println("B:in Second class"); } public static void main(String[] args) { new Second(); }}程序的输出结果是:______
查看答案
public class Example { String str = new String("Java"); StringBuffer sb = new StringBuffer("C#"); public void strcat(String str, StringBuffer sb) { str = str + " study"; sb = sb.append(" exam"); } public static void main(String args[]) { Example ex = new Example(); ex.strcat(ex.str, ex.sb); System.out.println(ex.str); System.out.println(ex.sb); }}程序的输出结果是:______
什么样的方法不能被重写( )
A. 私有(private)方法
B. 公有方法
C. 受保护的方法
D. 以上都不对
下列有关抽象类与接口的叙述中正确的是哪一个(JDK1.7及以下) ( )
A. 抽象类中必须有抽象方法,接口中也必须有抽象方法
B. 抽象类中可以有非抽象方法,接口中也可以有非抽象方法
C. 含有抽象方法的类必须是抽象类,接口中的方法必须是抽象方法
D. 抽象类中的变量定义时必须初始化,而接口中不是
能作为类的修饰符,也能作为类成员的修饰符的( )
A. final
B. extends
C. Float
D. static;