A Java project on abstract classes and methods
Before you begin this project, you need to be familiar with abstract classes and method in Java.
If you are not familiar with it already, watch this tutorial.
It is highly recommended to type and run the code along with the video on any IDE or using an online compiler such as online-java.com.
Write a program with one abstract class and two normal classes that extend from the abstract class. Create attributes, abstract methods and normal methods in each and then call the methods and print the attributes. This project will let you experiment with inheritance, abstraction and polymorhpism, thus helping you understand these topics.
-
-
If you're using an online compiler: Copy the code from the project file Country.java and paste it in an online java compiler. Change the class name and its references to "Main" to match the file name of the online compiler (or you can create a new file in the online compiler and name it the same as the file name given here). Watch this tutorial for full comprehension.
-
If you're using a code editor IDE: Download the code (ZIP file). Watch this to learn how to do that.
-
If you have git installed: Clone the repository.
-
-
There are four blocks of code you need to add. Each block comes with a number (example: // 1️⃣ FIRST) that indicates the order in which you must do the project. Complete the first block before moving on to the second, third and fourth. The instructions for the code you need to write are given with 🔴 emoji and the areas are marked with ⬇️⬆️ emojis. Do NOT write anything outside these areas.
-
Once you are done, run the code in your editor and make sure that your method is correct and your the format of your output matches the one given below.
Note: You can choose any continent, countries and corresponding languages, but the format should be the same as the one given above.
-
- If you're using an online compiler: Simply create a new file, add your filename including your name (eg: SalmaCountry.java) and open a pull request. Watch this to learn how to do that.
- If you're using a code editor IDE: Before submitting, change the name of the file to include your name. Watch this to learn how to do that.
For example:
If your name is Salma, change the name of the file to SalmaCountry.java - Similarly, change the name of your class (and all its references) to include your name (otherwise, the code will not run in your IDE).
- Then create a fork of this repository, submit your file and open a pull request. Watch this to learn how to do that.
Congratulations on completing the project!