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 do you mean by exception handling?
Does netbeans need jdk?
How do I start netbeans?
What is an action class in java?
Describe the principles of oops.
Write a program for the problem: the array of inetegers indicating the marks of the students is given, U have to calculate the percentile of the students aaccording to this rule: the percentile of a student is the %of no of student having marks less then him. For eg: suppose Student Marks A 12 B 60 C 80 D 71 E 30 F 45 percentile of C = 5/5 *100 = 100 (out of 5 students 5 are having marks less then him) percentile of B = 3/5*100 = 60% (out of 5, 3 have markses less then him) percentile of A = 0/5*100 = 0%.
What is @override annotation in java?
What is cookie in java?
What is the purpose of jdk?
What is the difference between Logical Parallelism and Physical Parallelism?
What is mdb in java?
What is the means of java?
What is csrf in java?
What is meant by code profiling?
What is jndi datasource in java?