In a prior video, you learn about how to use static methods that are called from a class without the class first being instantiated. But when a method needs to work with persistent data that’s stored within an object, it’s known as an instance method—that is, a method that belongs to an instance of the class.
- [Instructor] Just as with instance methods…that belong to an instance of a class,…there are also instance variables.…A variable that's declared within a method…is called a local variable.…It's local to that method.…So for example in this class InputHelper,…I have a variable called scanner.…It's an object,…it's declared and used within the method…and its reference expires when the method is done.…In a non-static class, when you declare a variable…that's in the class but outside of any methods,…that's an instance variable.…
Like the method, it won't have the keyword static.…Now, in this project, I've returned the InputHelper…to its static state.…That is the getInput method is static…and can be called directly from the InputHelper class.…And I have a starting Main method here.…I'm going to create a new class in my utilities package…that I'll call MathHelper.…Within the MathHelper class,…I'll declare a private variable…starting with the keyword private,…then the type, which will be int,…and then the variable identifier or name,…
- 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.