Please Clear this program error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Please Clear this program error

package javaapplication3; public class Robot { int xlocation; int ylocation; String name; static int ccount = 0; public Robot(int xxlocation, int yylocation, String nname) { xlocation = xxlocation; ylocation = yylocation; name = nname; ccount++; } } public class JavaApplication1 { public static void main(String[] args) { robot firstRobot = new Robot(34,51,"yossi"); System.out.println("numebr of robots is now " + Robot.ccount); } }

18th Sep 2018, 2:27 AM
hariharan
hariharan - avatar
1 Answer
+ 11
2 top level public classes are not aloud in one file 🤗💗
18th Sep 2018, 2:34 AM
NimWing Yuan
NimWing Yuan - avatar