Why i need put public for run compilation on eclipse. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why i need put public for run compilation on eclipse.

If i put class Myclass { } when i click run. eclipse return error and says you need write with "public class." why its happened?

23rd Oct 2016, 7:13 PM
Danis Salazar
Danis Salazar - avatar
1 Answer
+ 1
The main class needs to be public, since the main method will be innaccessible if it is not public
3rd Nov 2016, 7:11 AM
somestuffontheinternet
somestuffontheinternet - avatar