what is constructer?what are the type of constructer with
example.
Answer Posted / shiva krishna
class Shiva
{
public Shiva() // it is a constructor
{
//code
}
}
class Mainclass
{
public static void main(String args[])
{
Shiva obj=new Shiva();
}
}
explanation: the code written in constructor is
automatically executed when we create object for the
class.no need to call the constructor/method again.
point to note:
constructor must not have any return type
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
What is tier in java?
What is the use of servlet in java?
What services can invoke lambda?
What is java persistence api used for?
What can open a jar file?
Which instutute is offering course for rhino jain slee
What is a context in java?
How do I install java on windows?
What are orm tools in java?
How do you find lambda?
What are messages in java?
Can I use openjdk for commercial?
Can you compile java into exe?
What is cdi in java?
What is default constructor in java?