From d12bfe45934f21eebf09b8944aa0b2d0433cfa90 Mon Sep 17 00:00:00 2001 From: Aadit Agrawal Date: Sat, 14 Sep 2024 01:52:58 +0530 Subject: [PATCH] Add OOP/Java/Lab/Week6/Game/Gamer.java --- OOP/Java/Lab/Week6/Game/Gamer.java | 33 ++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 OOP/Java/Lab/Week6/Game/Gamer.java diff --git a/OOP/Java/Lab/Week6/Game/Gamer.java b/OOP/Java/Lab/Week6/Game/Gamer.java new file mode 100644 index 0000000..7eda681 --- /dev/null +++ b/OOP/Java/Lab/Week6/Game/Gamer.java @@ -0,0 +1,33 @@ +class Game { + + void type() { + System.out.println("Indoor & outdoor games"); + } +} + +class Cricket extends Game { + + void type() { + System.out.println("Cricket is an outdoor game"); + } +} + +class Chess extends Game { + + void type() { + System.out.println("Chess is an indoor game"); + } +} + +class Gamer { + + public static void main(String[] args) { + Game game = new Game(); + Game cricket = new Cricket(); + Game chess = new Chess(); + + game.type(); + cricket.type(); + chess.type(); + } +}