{
Public BorrowABook ()
{
}
Public void Borrow (String name)
{
System. The out. Println (" please to lending registration "+ name +", ");
}
Public static void main (String [] args)
{
BorrowABook book=new BorrowABook ();
The book, Borrow (" "war and peace" ");
}
}
CodePudding user response:
When there is no constructor class, compile with no arguments structure by defaultCodePudding user response:
Has no effect, don't write a no-parameter constructor will have default any constructor, but if you added a parameter of the constructor, need to manually make up a no-parameter constructorCodePudding user response:
When you didn't write a constructor, the compiler will help you to provide the class by default no arguments constructor; If you write the constructor, either have or no parameters, the compiler will not provide a default structure, so, you write above, when you delete the writing your own no arguments constructor, the compiler is to provide a no arguments will help you the default constructor, so does not have any effect, but if you wrote a no-parameter constructor, have deleted, no arguments constructor you wrote is the Main method of creating objects will compile error, suggest you don't have a no-parameter constructor or need to write parameters, and remember,,,,,