Static method | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 1

Static method

How to define method in Main if we not use "static" with method at declaration?

20th Oct 2019, 6:02 AM
Bilal Ahmed
Bilal Ahmed - avatar
2 ответов
+ 1
~ swim ~ Yes I thought in perspective of java. It's working in C# https://code.sololearn.com/c99O2yjQu4Q4/?ref=app
20th Oct 2019, 8:29 AM
A͢J
A͢J - avatar
0
Bilal Ahmed In main method everything will be static doesn't matter that you used static keyword or not. But you can call that method only in main method itself. You can't call them outside. Edited :- In java We can't create method directly in main. In case of this code we can create method using local class. https://code.sololearn.com/cRtRQuJUrg8s/?ref=app
20th Oct 2019, 8:13 AM
A͢J
A͢J - avatar