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
Is jdk required for netbeans?
In java thread programming, which method is a must implementation for all threads?
Topic- looping,function overloading,nesting ,polymorphism. Aim - to write a function with a name buzz-buds,that will check whether the given numbers are buddies or not on the basis of no. of parameters passed during function calling.
What is the locale class?
What is the difference between a jvm and a jdk?
What are the advantages of java sockets?
What does public static void main(string[]) mean?
What is map and flatmap?
How do you run an executable jar file?
What is the difference between java se and java ee?
How can c# app request minimum permissions? : java security
What is the difference between ec2 and lambda?
What gives java it’s “write once and run anywhere” nature?
How do you type the lambda symbol?
What are the rules regarding quotation marks?