1.3 - Types of Variables
Enroll to start learning
You’ve not yet enrolled in this course. Please enroll for free to listen to audio lessons, classroom podcasts and take practice test.
Practice Questions
Test your understanding with targeted questions
What is a local variable?
💡 Hint: Think about where a variable can be accessed.
What is an instance variable?
💡 Hint: Consider how objects relate to instances.
4 more questions available
Interactive Quizzes
Quick quizzes to reinforce your learning
What type of variable is declared inside a method?
💡 Hint: Think about the scope of variables.
True or False: Instance variables are shared among all instances of a class.
💡 Hint: Think about how objects work.
1 more question available
Challenge Problems
Push your limits with advanced challenges
Create a Student class with an instance variable name and a static variable numberOfStudents. Write methods to set the name, and to return both the name and the total number of students.
💡 Hint: Remember to increment the static variable when a new student is added.
In a game application, if each player has an instance variable score but a static variable highScore, what would happen if we only used a static variable for score?
💡 Hint: Consider the uniqueness required for each player.
Get performance evaluation
Reference links
Supplementary resources to enhance your learning experience.