which of the following statement is true. a. Instance mehod can access instance variable and instance methods directly . b. instance method cannot access class variables and class methods directly . c. class methods can access class variables and class methods directly. d. class methods cannot access instance variable or instance methods directly_they must use an object reference
Answers
Answered by
5
Answer:
follow me for answers Aditya Jha sir
Answered by
0
Answer:
a, c are true
Explanation:
- Instance methods provide direct access to instance variables and methods.
- Class variables and class methods are readily accessible through instance methods.
- Class variables and class methods are immediately accessible via class methods.
- I've learned from reading the Java documentation that a field declared with the "static" keyword is a class variable (or static field), and that a method defined with the "static" keyword is a static method (or class method). The class name itself serves as a reference for class variables and class methods.
- To execute an instance method, we must first construct an object of the class in which it is defined. Instance methods are methods that need the creation of an object of their class in order to be called.
- A class's instance variables are declared outside of any blocks, methods, or constructors.
#SPJ2
Similar questions