0
how a default constructor is created
what will be the value of default constructor
5 Answers
+ 2
if your class does not have any constructor, java automatically creates the default constructor. You cant see default constructor in your source code (thats obvious), but it is present in .class file after compilation by javac.
Furthe, even if you defined a constructor with null (like the default constructor is), it wont be called as called as default constructor. Means you cant create default constructor by your own.
0
if you don't define a constructor then default constructor is automatically created. there is no other way to create a default constructor. and default constructor provides random values to attributes, every time u create an object. you can see that value by using
class A {
int x;
system.out.println(int x);
}
0
default constructor has no parameters
- 2
class c
{
c ()
{}
}
- 3
The default contractor is created :
class NameClass{
NameClass{
}
}