adplus-dvertising
frame-decoration

Question

In below 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

Answer: (c).any class in the test package

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. In below code, what can directly access and change the value of the variable name?

Similar Questions

Discover Related MCQs

Q. Which of these method of class String is used to compare two String objects for their equality?

Q. Which of these methods is used to compare a specific region inside a string with another specific region in another string?

Q. Which of these methods of class String is used to check whether a given object starts with a particular string literal?

Q. Which of these data type value is returned by equals() method of String class?

Q. Which of this method of class String is used to extract a substring from a String object?

Q. Which of these method of class String is used to remove leading and trailing whitespaces?

Q. What is the value returned by function compareTo() if the invoking string is greater than the string compared?

Q. Which of the following statement is correct?

Q. Which of these class is used to create an object whose character sequence is mutable?

Q. Which of this method of class StringBuffer is used to concatenate the string representation to the end of invoking string?

Q. Which of these method of class StringBuffer is used to find the length of current character sequence?

Q. Which of the following statement is correct?

Q. Which of these methods of class StringBuffer is used to extract a substring from a String object?

Q. Which of this method of class StringBuffer is used to reverse sequence of characters?

Q. Which of this method of class StringBuffer is used to get the length of the sequence of characters?

Q. Which of the following are incorrect form of StringBuffer class constructor?