hi,
can anyone tell me why the following code's output is "null" instead of "Person"?
class Person{
private
String sName="Person";
public String getName(){
return sName;
}
public void setName(String sName){
this.sName=sName;
}
}
class User extends Person{
private String sName;
public String getName(){
return sName;
}
public void setName(String sName){
this.sName=sName;
}
}
public class Killer{
private String sName;
public static void main(String argv[]){
new Killer();
}
Killer(){
Person p = new User();
System.out.println(p.getName());
}
}
thanks in advance!!!
regards
pbg!!!