Tuesday, 30 August 2016

Default con.

1.       Default constructor:-
Definition : Default constructor provided by the compiler when we have not provided any constructor explicitly. If we provide any constructor explicitly in java clas then  compiler will not provide any default constructor.
In java applications, compiler will provide 0-Arg Constructor as default constructor with the same class scope.
Ex:-
File name D:\java1130\Test.java
public class Test
{

}
on Command prompt
D:\java1130\javac Test.java
D:\java1130\javap Test

Compiler from Test.java

public class Test extends java.lang.Object
{
                public Test()
                {
     
                }

}


No comments:

Post a Comment