When designing an object-oriented, contract-based programming architecture, you can frequently choose between using interfaces and abstract classes. An abstract class is abstract because you add the abstract keyword, and then it can contain a mixture of fully implemented methods and abstract methods. Because it’s abstract, you can’t instantiate directly—you have to use one of its subclasses.
- [Instructor] When designing an object-oriented contract…based programming architecture,…you can frequently choose between using interfaces…and abstract classes.…You mark an abstract class with the abstract keyword…in the class declaration.…When it's abstract, it can't be instantiated directly.…You have to use one of its subclasses.…So, in this project I'll go to clothing item dot java.…And I'm going to turn clothing item into an abstract class.…I'll just add the keyword abstract right here.…
I need to keep the class keyword as well.…Now, that class can't be instantiated directly.…And if I go to the main class,…I see an error condition now,…saying that clothing item is abstract,…cannot be instantiated.…I'm going to just comment out that bit of code.…I'm not going to need it anymore.…But notice, I can still instantiate the subclass,…shirt,…using the shirt classes constructor and its type.…And I can still create an object that's typed…as the superclass as long as I…use one of the subclasses constructors.…
In addition to abstract classes,…
- Debugging Java code
- Handling exceptions
- Creating custom classes
- Working with inheritance
- Managing data collections
- Using Java packages and libraries
- Preparing a Java application for deployment
Skill Level Intermediate
1. Exception Handling and Debugging
2. Create Custom Classes
3. Work with Inheritance
4. Manage Data Collections
5. Use Java Packages and Libraries
Work with dates and times7m 12s
6. Prepare a Java Application for Deployment
Next steps1m 12s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.