JOBSEEKERS
Login
Sign Up
Jobseeker
Employer
Staffing Firm
Direct Client
Java interview questions part 14
Java interview questions part 14
Back
Take as many assements as you can to improve your validate your skill rating
Total Questions: 8
1. Which of the following modifier means a particular variable cannot be accessed within the package?
A. private
B. public
C. protected
D. default
Show Correct Answer
Correct Answer is :
private
2. How can a protected modifier be accessed?
A. accessible only within the class
B. accessible only within package
C. accessible within package and outside the package but through inheritance only
D. accessible by all
Show Correct Answer
Correct Answer is :
accessible within package and outside the package but through inheritance only
3. What happens if constructor of class A is made private?
A. Any class can instantiate objects of class A
B. Objects of class A can be instantiated only within the class where it is declared
C. Inherited class can instantiate objects of class A
D. classes within the same package as class A can instantiate objects of class A
Show Correct Answer
Correct Answer is :
Objects of class A can be instantiated only within the class where it is declared
4. All the variables of interface should be?
A. default and final
B. default and static
C. public, static and final
D. protect, static and final
Show Correct Answer
Correct Answer is :
public, static and final
5. What is true of final class?
A. Final class cause compilation failure
B. Final class cannot be instantiated
C. Final class cause runtime failure
D. Final class cannot be inherited
Show Correct Answer
Correct Answer is :
Final class cannot be inherited
6. How many copies of static and class variables are created when 10 objects are created of a class?
A. 45301
B. 45575
C. 45566
D. 45292
Show Correct Answer
Correct Answer is :
45301
7. Can a class be declared with a protected modifier.
A. TRUE
B. FALSE
C.
D.
Show Correct Answer
Correct Answer is :
FALSE
8. Which is the modifier when there is none mentioned explicitly?
A. protected
B. private
C. public
D. default
Show Correct Answer
Correct Answer is :
default
Similar Interview Questions
Search for latest jobs
Find Jobs