I have a question about how to define a method from a subclass or a parent class. For example:
public class Thought
{
//-----------------------------------------------------------------
// Prints a message.
//-----------------------------------------------------------------
public void message()
{
System.out.println ("I feel like I'm diagonally parked in a " +
"parallel universe.");
System.out.println();
}
}
And the child class is:
public class Advice extends Thought
{
//-----------------------------------------------------------------
// Prints a message. This method overrides the parent's version.
//-----------------------------------------------------------------
public void message()
{
System.out.println ("Warning: Dates in calendar are closer " +
"than they appear.");
System.out.println();
super.message(); // explicitly invokes the parent's version
}
}
If I wanted to invoke method message from the main method, would I have to use Thought.message, or Advice.message since I used the super invoker. Does super.(method)() technically just copy and paste the parent method into the child method, allowing you to create an object of only the child?