Is it possible to create object with out its default
constructor? if possible how? else not possible? justify
Answer Posted / 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 |
Post New Answer View All Answers
What is public/private protected in java?
What is the difference between a window and a frame in java programming?
What is consumer in java?
Can an arraylist be empty?
What is rmi and steps involved in developing an rmi object?
What is the effect of keeping a constructor private?
What is considered an anti pattern?
What is the difference between inner class and nested class?
How do I convert a string to an int in java?
What is difference between == equals () and compareto () method?
What is default exception handling in java?
Does java set allow duplicates?
What is indexof?
What is the difference between Java1.4 and Java1.5
What are the benefits of operations in java?