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 javax annotation generated?
What is meant by java se?
What is meant by annotations in java?
Where are group policies stored? : java security
Why do we need new date and time api in java se 8?
What is the locale class?
What is a stream in programming?
What is proxy object in java?
What is the use of servlet in java?
What is map and flatmap?
How do I enable java in google chrome?
What is mq in java?
Can we install jre without jdk?
Who is at risk in java? : java security
how can we create the ui using netbeans,having the code?