Join Peggy Fisher for an in-depth discussion in this video Creating classes, part of Java Essential Training for Students.
- Now that we know exactly what data…and methods we need,…let's review a payroll application…that uses an employee class…and an address class.…In the same project folder as the main program,…there are two seperate files…for the employee class and the address class.…Let's start by reviewing the employee class.…Remember, all this data was listed in the UML diagram.…In the employee class, we start by…defining all the instance data.…Think of these fields as the attributes…of an employee.…
These are the fields that we refer to as…the state of the employee.…Starting on line nine,…we have private String firstName,…then we have lastName,…phoneNumber, address, employeeID,…deptID, title, and salary.…Notice that these variables are all defined as private.…This is how we enforce data integrity.…Usually, right after the instance data…you have your constructor.…Let me scroll down a little bit.…The constructor is easy to identify…because it has no return type,…and it has the exact same name as the class.…
In our case, that's public employee.…
- Getting started with parsing
- Reviewing data types
- Using decisions
- Creating user-defined methods
- Command-line debugging
- Exploring the Java API
- Creating and instantiating classes
- Working with interfaces
- Storing items with arrays
Skill Level Intermediate
Q: How can I make my debugger function like the author’s?
1. Command Level Programming
2. Basics Review
4. Java API
5. Simulations and Algorithm Analysis
6. Classes and Objects
7. More on Classes
8. Data Structures
- 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.