* **********************Difference Between Method And - TopicsExpress



          

* **********************Difference Between Method And Constructor************************** Method: 1.Method should have a return type (Null Also). Constructor: 1.Constructor should not have any return type(Null also). Method: 2.Method is used to operate the value in all possible ways. Constructor: 2.Constructor is mainly used to initialise the instance variable. Method: 3.With method you can use any access modifiers it depends up on requirment . Constructor: 3.With the constructor you can use only public,protected,private access modifier. Method: 4.Compiler can not define or create by default any method. Constructor: 4:Compiler defining a default constructor with no argument if you are not defining any constructor (parametrise/no-paramitrise) explicitly. Method: 5.Syntex:[Modifier]([]) throws [] { //Statement } Constructor: 5.Syntex:[Modifier]([]) throws [] { //Statement } -------------------------------------------------------Refer Progam Exampe(Test_Method.java) Also-------------------------------------------------
Posted on: Sun, 09 Jun 2013 20:31:07 +0000

Trending Topics



Recently Viewed Topics




© 2015