+ 1
Java! Need help with terminology
Badly need help with this matching. All the best to everyone who can help. I passed a terrible quiz, but this question is the only one that I can't take. public class Person { private char gender; static int number; //... public static void main(String[] args) { Person person; //... } public static void callPerson(int hours) { double payRate = 24.99; } } The code above compiles okay. Refer to it to complete this matching exercise. number is ____ hours is ____ gender is ____ person is _____ payRate is _____ Options: 1. local reference variable 2. class variable 3. instance variable 4. parameter 5. local primitive variable
2 Answers
+ 1
number is defined in class and static, so it belong to any instance of the class, so it's class variable
hours is passed to the function on call, so it's parameter
gender is defined in the class, but it's not static, so it belongs to certain class instance, so it's instance variable
person is an instance of a class, defined inside a method, so it's local reference varible
payRate is an instance of a primitive type, defined inside a method, so it's local primitive variable
0
ŠŃже Š“ŃŠŗŃŃ!)