Hey Aliens, In this post we are going to share with you a very simple program called , Abstract Example Game Program. Normally in this program we use an abstract class , and also we have another 2 class GameA and GameB . This two classes will extend the abstract class and they will use the abstract class method called stop. I hope this program don’t need more explanation. this abstract example will help you to visualize the real time scenario for abstract class uses.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
package com.practice.house; abstract class Games { public abstract void start(); public void stop() { System.out.println("Stopping game inside the abstract class"); } } class GameA extends Games { @Override public void start() { System.out.println("Starting Game A - Started"); } } class GameB extends Games { @Override public void start() { System.out.println("Starting game B - Started"); } } class AbstractExampleGame { public static void main(String[] args) { Games A = new GameA(); Games B = new GameB(); A.start(); A.stop(); B.start(); B.stop(); } } |
OUTPUT:
1 2 3 4 |
Starting Game A - Started Stopping game inside the abstract class Starting game B - Started Stopping game inside the abstract class |
Thanks for stopping by here . i hope you would like to stay tune with use to learn more coding example.
HAPPY CODING … HAPPY LIVING.

Java – PHP – Python – Dart – Flutter – MySql – Spring – Hibernate – JavaScript – jQuery – BootStrap 4 – CSS – HTML
I love to explore new technologies. If you like my tutorials please share your thoughts about my work.
Check out my YouTube Channel For Video Tutorials.
To Hire Me Please Contact Me Through Social Media or https:www.amialif.com
If you want to help others by doing donation please Help Them.
You also can connect with me via social media. Thanks
I discovered your website from Google and also I need
to say it was a terrific find. Many thanks!