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
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 |
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 |
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 |
What is formatted output in java?
How many bytes are there?
What is the program compilation process?
Does substring create a new object?
Is null an object java?
What is http client in java?
Is array a class in java?
What is jit compiler ?
what is a working thread? : Java thread
we have two threads..both the threads are reading the data.. is there any need of synchronization there?...justify it?
Explain 5 features introduced in jdk 1.7?
What does exclamation mean in java?