black

SCJP程序员认证考试

登录

单项选择题

Given the following code:    
1) class Parent {    
2) private String name;    
3) public Parent(){}    
4) } 
5) public class Child extends Parent {    
6) private String department; 
7) public Child() {} 
8) public String getValue(){ return name; }    
9) public static void main(String arg[]) {    
10) Parent p = new Parent();    
11) } 
12) } 
Which line will cause error?()   

A. line 3
B. line 6
C. line 7
D. line 8
E. line 10

相关考题

单项选择题 AButtonispositionedinaFrame.OnlyheightoftheButtonisaffectedbytheFramewhilethewidthisnot.Whichlayoutmanagershouldbeused?()

单项选择题 class Parent {     String one, two;  public Parent(String a, String b){     one = a;     two = b;    }  public void print(){ System.out.println(one); }    }  public class Child extends Parent {     public Child(String a, String b){     super(a,b);     }  public void print(){  System.out.println(one + " to " + two);     }  public static void main(String arg[]){     Parent p = new Parent("south", "north");     Parent t = new Child("east", "west");     p.print();     t.print();     }     }  Which of the following is correct?()

多项选择题 public class Parent {     int change() {…}     }  class Child extends Parent {     }  Which methods can be added into class Child?()

All Rights Reserved 版权所有©易学考试网(yxkao.com)

备案号:湘ICP备2022003000号-3