Welcome Guest | Sign in | Register
Inheritance - Discussion Page For Q.2854 | Java Programming Questions and Answers | Java Programming Free Online-Tests | LucentBlackBoard | LucentBlackBoard.com

Home > Java Programming > Inheritance > Questions and Answers

Q: class v{
private v(){
System.out.println(1); } }

class manager {
public static void main(String args[]){
v v1=new v();
v1.v(); } }
A. 1 B. 2
C. compile time error D. runtime error

Answer and Explanation

Answer:compile time error

Explanation:
if constructor is private you can not create an object from other class if you try to create then it will throw an compile time error , if you want to create then create from same class.  

Comment on this Question

Name:

Loading...




Partner Sites
LucentBlackBoard.com                  SoftLucent.com                  LucentJobs.com
All rights reserved © 2012-2015 SoftLucent.