If i create a method and i dont specify a type, will it be a String? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

If i create a method and i dont specify a type, will it be a String?

Thats all lol.

18th Dec 2016, 11:39 PM
Andrés Alejandro Molina Rodriguez
Andrés Alejandro Molina Rodriguez - avatar
6 Answers
+ 2
If you don't specify the method type, your program won't compile
18th Dec 2016, 11:58 PM
Dago VF
Dago VF - avatar
+ 2
The only required elements of a method declaration are: - the method's return type, (void , int string, double, string...) -name, -a pair of parentheses, (), -instruction between braces, {} return type is required ;)
19th Dec 2016, 12:49 AM
Adnen Rebai
Adnen Rebai - avatar
+ 1
Not in Java The closest thing is type void, means the method doesn't reruns any value But again, you have to explicitly declare that
19th Dec 2016, 12:03 AM
Dago VF
Dago VF - avatar
0
Ive seen an unspecified method in this app
18th Dec 2016, 11:59 PM
Andrés Alejandro Molina Rodriguez
Andrés Alejandro Molina Rodriguez - avatar
0
directly it won't compile, and where have you seen that method? in the course? which part?
19th Dec 2016, 12:16 AM
R P
R P - avatar
0
if you don't specify the type the program won't work
28th Dec 2016, 4:07 PM
t_josh
t_josh - avatar