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 are the methods available in a class?
Write a program to solve producer consumer problem in java?
Name the components that are termed to be Heavy-weight component but available in Light-weight components?
What do the thread?class methods run() and start() do?
Which is bigger float or double java?
How would you convert bytes to string?
Why bytecode is called bytecode?
How to sort array in descending order in java?
Are floats faster than doubles?
Difference between a process and a program?
What isan abstract class and when do you use it?
I want my class to be developed in such a way that no other class (even derived class) can create its objects. Define how can I do so?
What is the type of lambda expression?
Can we start a thread twice in java?
What are design patterns and please explain?