Learn Java Tutorial for Beginners (Video), Part 38: Abstract Classes

Abstract classes allow you to define the parent class of a new hierarchy without having to worry about the user actually instantiating the parent. For instance you could create an "Animal" class just to act as the basis for "Dog", "Cat, "Sheep" and so on, even defining some functionality in "Animal", but at the same time preventing the user of your hierarchy from trying to create an "Animal" object (which after all wouldn't make much sense -- you never encounter an abstract "animal" in the real world; only particular kinds of animals).

When the video is running, click the maximize button in the lower-right-hand corner to make it full screen.

publicclassCameraextendsMachine{@Overridepublicvoidstart(){System.out.println("Starting camera.");}@OverridepublicvoiddoStuff(){System.out.println("Taking a photo");}@Overridepublicvoidshutdown(){System.out.println("Shutting down the camera.");}}