Q. In the following Java code, what can directly access and change the value of the variable name?
package test;
class Target
{
public String name = "hello";
}

  • (A) any class
  • (B) only the Target class
  • (C) any class in the test package
  • (D) any class that extends Target
πŸ’¬ Discuss
βœ… Correct Answer: (C) any class in the test package

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
102
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Ravi Shankar
Publisher
πŸ“ˆ
83%
Success Rate