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 / kumar
By default,the package and class are public.the result will
be 4 any class that extends Target.
| Is This Answer Correct ? | 0 Yes | 4 No |
Post New Answer View All Answers
what is abstract class in Java?
design an lru cache in java?
What is int argc char * argv?
explain the concept of virtual method invocation in polymorphism in detail?
Can we pass null as argument in java?
Is set thread safe java?
Detail discussions on JVM, memory management and garbage collector.
What is final keyword in java? Give an example.
What are java threads?
What is the difference between private & public & friendly classes?
Explain the available thread states in a high-level?
Explain about static imports in java?
Can you declare the main method as final?
what is the constructor and how many types of constructors are used in java?
What is a local, member and a class variable?