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
there are 67 seats in train . there are only 5 seats in a row and in last row there are only 2 seats. One person can reseve only 5 seat at a time. If person reserving seat , the care is atken that he may get all in row. if seats are not available in row then the arrangement is so that person group get nearby seats. the following class is given public class seat { char name; int seat; boolean isSeatempty } 1.Draw require class digram and object diagram. 2.Write function seatallot(int noofperson) to allocate seat with seat nuber printed for the each name.
What is java persistence api used for?
What are the disadvantages of java sockets?
Which class is the superclass of every class?
How can the static main method use instance variables?
What is a container in java?
How do I enable java in firefox?
What is ehcache in java?
How do you type the lambda symbol?
What's the difference between authentication and authorization? : java security
What are the advantages of lambda functions?
What is an entity in java?
What is mdb in java?
How do I enable java in google chrome?
How do you run an executable jar file?