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
22 views



Related Hot Questions



Government Jobs Opening


...