r/javahelp • • Aug 31 '22

Unsolved Java Static

Why cannot we use System.out.println(), outside <main()> or any static function ?

0 Upvotes

7 comments sorted by

View all comments

2

u/Chemical-Asparagus58 Sep 01 '22

You can use System.out.println() in all methods, maybe you had a typo or didn't add a semicolon at the end when you wrote it into your code so it didn't work.