where to I write all the methods? before the main? in the main? I did not understand it | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 2

where to I write all the methods? before the main? in the main? I did not understand it

28th Sep 2016, 4:21 PM
Or Orsatti
Or Orsatti - avatar
6 Respostas
+ 8
Methods are written outside of the Main() method, but inside the class. You can write methods anywhere in the class, but Main() is always run first. So usually, new methods are listed below Main().
28th Sep 2016, 5:48 PM
Tamra
Tamra - avatar
+ 7
Every Method is written in the class, to write a method class is compulsory. We write all the methods inside of a class. Main() method is also written inside of a class . We can not write methods out side of a class. We can use Constructor to initialize variables and to write methods. Main() is a method that always execute first when we run our program. when we have multiple methods inside the class we can call them or execute them by simply write method name with () inside Main() method. for example: MethodName(); Main() method is used to execute other method or to make an object(instance) of a class.
29th Sep 2016, 1:00 PM
Paras Jain
Paras Jain - avatar
+ 1
immediately after 'class' and it's bracket. just before main
29th Sep 2016, 12:16 PM
Memphis Ndego
Memphis Ndego - avatar
+ 1
out side the main but in the same class so you can use that method easily.
22nd Oct 2016, 4:33 AM
Mueed Saleem
Mueed Saleem - avatar
+ 1
write it before or after, class zzzzz { --here your method-- static void main(Str) {- -} or here
21st Nov 2016, 5:04 PM
sathish v
sathish v - avatar
- 1
Just write it out of main.
28th Sep 2016, 6:38 PM
alireza
alireza - avatar