+ 2

Do you think it is a header for a constructor or a method?why?

public Employee( string name, string emploteeNumbet )

6th Mar 2017, 9:18 PM
AlexL
AlexL - avatar
5 Answers
+ 12
Constructor because there's no return type
6th Mar 2017, 9:47 PM
Jafca
Jafca - avatar
+ 12
Methods are declared like this: modifier returnType methodName(paramType param) { } There are more options like static, final, exceptions that I miss out for simplicity. A constructor is method-like, but declared like this: modifier className (paramType param) { } It has a return type, but as it always returns an object of the constructor's class it must not be declared.
6th Mar 2017, 11:13 PM
Tashi N
Tashi N - avatar
+ 11
The other things. The "int" in "public static int Main()" and the "String" in "public String GetName()"
6th Mar 2017, 9:59 PM
Jafca
Jafca - avatar
+ 2
thank you very much, I always make this up in class, but thanks to this app, I m much clear with the basic concept now, also other user are very nice ! thumbs up to this app
6th Mar 2017, 11:18 PM
AlexL
AlexL - avatar
+ 1
do you mean the ' ; ' ? or other things?
6th Mar 2017, 9:56 PM
AlexL
AlexL - avatar