+ 2
where to I write all the methods? before the main? in the main? I did not understand it
6 odpowiedzi
+ 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().
+ 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.
+ 1
immediately after 'class' and it's bracket. just before main
+ 1
out side the main but in the same class so you can use that method easily.
+ 1
write it before or after,
class zzzzz
{
--here your method--
static void main(Str)
{-
-}
or here
- 1
Just write it out of main.