Pre Exam Test Practice (SSC | Banking | IAS | GATE | State Level | CLAT | Railways | Insurance | Teaching Exams | NDA | Defence | IES |State Exam )

Organizational Research By

Surprising Reserch Topic

What is the difference between a constructor and method?


A constructor is called implicitly whenever an object is created. But a method is to be called explicitly.
 
A constructor cannot be static but a method can be. When the following code is compiled. the compiler complains "modifier static not allowed here".
 
 
public class cunstest extends Test
{
  public static Demo() {}
}
 

asked Sep 13, 2013 in Core java by itkbc
edited Sep 12, 2013
0 votes
23 views



Related Hot Questions



Government Jobs Opening


...