What is a "subclass" in java?
I know about classes and methods, but I do not know about subclasses.
A subclass is a class that extends another class.
public class BaseClass{
public String getFoo(){
return "foo";
}
}
public class SubClass extends BaseClass{
}
Then...
System.out.println(new SubClass().getFoo());
Will print:
foo
This works because a subclass inherits the functionality of the class it extends.