Learning Java/Fundamental exercises

1. Fix It!

edit

Fix this code so it compiles and runs correctly (your file name is Main.java)

private class main {
	private static int main() {
		system.out.println('Hello World!')
		return 0
	}
}

2. A Full WaterVehicle, Ship, etc.

edit

This exercise comprises of a base class WaterVehicle. It will also have a class Ship, a class Boat, a class WaterAirplane, and a class Submarine.

WaterVehicle Methods:

updateSpeed(int) will update the speed to a valid speed - higher than minSpeed and lower than maxSpeed

You can choose what to use.

Note: Ship, Boat, and WaterAirplane should extend WaterVehicle.

When you are done, you can create a main class to run your program. For example, the main class could create an instance of WaterAirplane and try using the methods.

Submit Exercises

edit

If you have any ideas for exercises that are related to what beginners learned in the fundamentals section, feel free to put them here. Note: It will look nice if you put them before this and make their name with a title2 (2 equal sign).




You are ready to move on! Inheritance. Note that it is not complete...
Back to Java Main Page