Please explain me more about static | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Please explain me more about static

Here i have an error, if i don't put static keyword. https://code.sololearn.com/cahdy18OsKo4/?ref=app

16th Apr 2021, 10:50 AM
Jawahirullah
Jawahirullah - avatar
7 Answers
+ 1
Check Java tutorial 37.1
16th Apr 2021, 11:28 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 1
Static before methods mean that the method doesn't belong to any object, but the class itself, which allows you to use the method with the class name. https://www.sololearn.com/learn/Java/2159/
16th Apr 2021, 11:42 AM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 1
Hope this helps you
16th Apr 2021, 11:45 AM
Atul [Inactive]
+ 1
So in the above code you need to write static
16th Apr 2021, 11:46 AM
Atul [Inactive]
+ 1
Rik Wittkopp the link is not clickable. Better you resend that link
16th Apr 2021, 11:53 AM
Atul [Inactive]
+ 1
Atul Thanks for letting me know
16th Apr 2021, 11:54 AM
Rik Wittkopp
Rik Wittkopp - avatar