I think you might have gotten the indenting wrong, because the TestClass class is an inner-class of the Barbie class:
Code: Select all
class Barbie extends Doll{
Barbie(){
//1
}
Barbie(String nm){
//2
}
public class TestClass {
public static void main(String[] args) {
Barbie b = new Barbie("mydoll");
}
}
}
The following would be correct, given that the file is named TestClass.java:
Code: Select all
class Barbie extends Doll{
Barbie(){
//1
}
Barbie(String nm){
//2
}
}
public class TestClass {
public static void main(String[] args) {
Barbie b = new Barbie("mydoll");
}
}