Given:
1. package test;
2.
3. class Target {
4. public String name = “hello”;
5. }
What can directly access and change the value of the
variable name?
1 any class
2 only the Target class
3 any class in the test package
4 any class that extends Target
Answer Posted / manikandan [ gtec,vellore ]
Public is Visible to everywhere.
Private is visible to only the same class.
Protected is visible in same package and also sub classes in
any package.
Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
Does google use java?
Name and explain the types of ways which are used to pass arguments in any function in java.
What are the advantages of java over C++?
How do I find and replace in word?
What is a variable analysis?
How do I remove a character from a string in java?
How to calculate the length of a singly linked list in java?
Why do you canvas?
What are different access specifiers in java?
What is annotation in java?
Can we use a default constructor of a class even if an explicit constructor is defined?
Tell me a few examples of final classes defined in Java API?
What is a lock or purpose of locks in java?
What is multi-catch block in java?
Is void a data type in java?