Is it possible to create object with out its default
constructor? if possible how? else not possible? justify

Answers were Sorted based on User's Feedback



Is it possible to create object with out its default constructor? if possible how? else not possib..

Answer / dsr

with out default constructor we can't create the object.
suppose we can't write default constructor in the class.
JVM will be creating the default constructor for that class.

Is This Answer Correct ?    9 Yes 1 No

Is it possible to create object with out its default constructor? if possible how? else not possib..

Answer / vamsi

Yes, it is possible to create an object without its default
constructor. We can create a parametrized constructor or if
you have not created any thing then the compiler will
provide you with one default constructor.

Is This Answer Correct ?    2 Yes 0 No

Is it possible to create object with out its default constructor? if possible how? else not possib..

Answer / ravi

class C
{
void show()
{
System.out.println("hi");
}
public static void main(String args[])
{

C c=new C();
c.show();
}
}


we can create object if we don't write the constructor try
execute the above code and see the result; THANK u

Is This Answer Correct ?    1 Yes 0 No

Is it possible to create object with out its default constructor? if possible how? else not possib..

Answer / suresh royal

yes we can create object without using default constructor.
we can use argument constructor...
this is the example prg
===========================================
class ExArgCon
{
ExArgCon(int a)
{
System.out.println("arg constroctor");
}
public void m1()
{
System.out.println("m1() method");

}
public static void main(String[] args)
{
ExArgCone = new ExArgCon(10);
e.m1();
}
}

Is This Answer Correct ?    1 Yes 0 No

Is it possible to create object with out its default constructor? if possible how? else not possib..

Answer / sitaram

we can write the without constructor in the class. when
ever class will be loaded, JVM will be creating defalt
constructor for that class.

Is This Answer Correct ?    4 Yes 4 No

Post New Answer

More Core Java Interview Questions

what is the difference between ArrayList and Vector

19 Answers   KPIT, Sasken, Satyam, Span Infotech, Wipro,


Why declare Main() inside the class in java ?

0 Answers   HCL,


What is the difference between conversation & casting?

0 Answers  


how can be object class inherited to all class in a program when java does not support multiple inheritance??

4 Answers  


What is the default access specifier for variables and methods of a class?

0 Answers  


What is operator overloading. Is it is supported in java?

0 Answers  


What about instanceof operator in java?

0 Answers  


How can you reverse a string?

8 Answers  


Can a constructor be private and how are this() and super() method used with constructor?

0 Answers   Flextronics, Hexaware,


what is the difference between thread and runnable types? : Java thread

0 Answers  


what is mean by String and StringBuffer? What is mean by Methooverriding and Overloading?

2 Answers   Satyam,


design an lru cache in java?

0 Answers  


Categories