Declaration and Access Control on Java related Questions and Answers

Question 2 : Given a method in a protected class, what access modifier do you use to restrict access to that method to only the other members of the same class?
1. final
2. static
3. private
4. protected
View Answer   Discuss with Members

Question 3 : Which of the following class level (nonlocal) variable declarations will not compile?
1. protected int a;
2. transient int b = 3;
3. private synchronized int e;
4. volatile int d;
View Answer   Discuss with Members

Question 5 : You want a class to have access to members of another class in the same package. Which is the most restrictive access that accomplishes this objective?
1. public
2. private
3. protected
4. Default Access
View Answer   Discuss with Members

Question 6 : What is the most restrictive access modifier that will allow members of one class to have access to members of another class in the same package?
1. public
2. abstract
3. protected
4. default access
View Answer   Discuss with Members

Question 7 : What is the prototype of the default constructor?
1. Test( )
2. Test(void)
3. public Test( )
4. public Test(void)
View Answer   Discuss with Members

Question 8 : You want subclasses in any package to have access to members of a superclass. Which is the most restrictive access that accomplishes this objective?
1. public
2. private
3. protected
4. transient
View Answer   Discuss with Members


View 1 - 8 of 8 Questions

* Be the First to Post a Comment.

Submit comment :


Captcha Image
Reload

Ask Question

Captcha Image
Reload

Note : Name and Email never shown.





Subscribe


Become a part of EducationForever. Subscribe to our FREE Newsletter