How to create a subclass

The syntax for creating subclasses:

Description Syntax
To declare a subclass public class SubclassName extends SuperClassName{}
To call a superclass constructor super(args)
To call a super class super.methodName(argumentList)

public class Book extends Product
{
private String author;
public Book()
{
super(); // call constructor of Product superclass
author = "";
count++; // update the count
}
public void setAuthor(String author)
{
this.author = author;
}
public String toString() // override the toString method
{
return super.toString() + // call method of Product superclass
"Author: " + this.author;
}
}