Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
abstract class Restaurant {

//insert abstract method

}

public class AbstractClassesTutorial {

//Create 4 classes that extend the abstract class

public static void main(String[] args) {

//print out the 4 abstract classes

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
abstract class Restaurant {

public abstract void food();

}

class Tacobell extends Restaurant {
public void food() {
System.out.println("Tacos!");
}
}

class Pizzahut extends Restaurant {
public void food() {
System.out.println("Pizza!");
}
}

class McDonalds extends Restaurant {
public void food() {
System.out.println("Burgers!");
}
}

class KFC extends Restaurant {
public void food() {
System.out.println("Chicken!");
}
}

public class AbstractClassesTutorial {

public static void main(String[] args) {
Tacobell t = new Tacobell();
t.food();
Pizzahut p = new Pizzahut();
p.food();
McDonalds m = new McDonalds();
m.food();
KFC k = new KFC();
k.food();

}
}