In this video, Doug Winnie explains how to create new class blueprints based on existing classes. By extending classes, you can create new classes that have all of the members of the original class.
- [Instructor] When we create a class,…we can use one blueprint as a basis for another.…That is called extending the class.…In our project, we have a class called Cat.…We can use this and extend it to create a new unique class.…Right-click on the com.company folder…and select New, Java Class.…Enter the name of Lynx,…L-Y-N-X…and click OK.…Inside the new empty Lynx class,…we want to have this be based on the Cat class.…
To do that, go to the class definition…and then after Lynx,…add extends Cat.…Now everything that is part of the Cat class…is now part of the Lynx class.…This includes any members that are inside.…Let's create the constructor next,…public…Lynx.…Inside, we can put a confirmation message…that our class was created.…System.out.println…A new instance of Lynx created.…
Now, Lynx is a wild animal,…so they might not purr all the time.…They would growl.…So, that is a unique method…that we can add to our class here.…Public…void…growl.…System.out.println…Grrrr.…With our new class created,…let's go ahead and put it to use.…
- The history of Java
- Setting up your development environment
- Working with values and variables
- Using methods and functions
- Capturing user input
- Creating conditional tests
- Using loops
- Creating and changing arrays
- Object-oriented programming in Java
- Defining permissions
- Extending classes
Skill Level Beginner
Computer Science Principles: The Internetwith Doug Winnie59m 30s Beginner
Java Essential Training for Studentswith Peggy Fisher3h 6m Intermediate
1. Intro to Java
2. Define Actions Using Code
3. Repeat Actions and Test for Conditions
4. Object-Oriented Programming Basics
Next steps1m 44s
- 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.