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
Give some features of interface?
Why java is not 100% object-oriented?
What are the types of web technologies?
What is variable length arguments in java?
What is meant by object?
What is a jit compiler?
How do you join strings in java?
How are variables stored?
How is java hashmap implemented?
What is instanceof keyword?
What is a default constructor and also define copy contrucyor?
What are methods in java?
What are mutable classes?
What is the difference between superclass and subclass?
What is the diffrence between inner class and nested class?