Used for: representing parent classes that exist only for being a parent class.
Syntax: abstract (class keyword)
We cannot make instances of this class (cannot use “new” keyword)
Method that exist only to provide structure
Syntax: list modifier abstract with the method
abstract classesThe greeter classes represent various ways to greet someone
getName, greetname – should be handled well (set in constructor)Things to note:
Submit your Greeter.java, Informal.java and Formal.java to gradescope
You can use this Greet.java main to test your code in your computer:
public class Greet {
public static void main(String[] args) {
Greeter boss = new Formal("Ms.", "Silva");
boss.greet();
Greeter friend = new Informal("Joe");
friend.greet();
}
}Good day, Ms. Silva.
What's up, Joe?
Greeter.javaFormal.javaInformal.java