Main.java:1: error: class Tictactoe is public, should be declared in a file named Tictactoe.java. -> public class Tictactoe{ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Main.java:1: error: class Tictactoe is public, should be declared in a file named Tictactoe.java. -> public class Tictactoe{

I compile this code, compiler show me error, what should I do?

2nd Apr 2021, 3:17 PM
Gayatri Dunakhe
Gayatri Dunakhe - avatar
1 Answer
0
To resolve this error, you should rename the file Main.java to Tictactoe.java to match the public class name declared inside. This ensures that the file name matches the public class name, allowing the compiler to properly identify and link them together.
14th Apr 2024, 6:24 AM
`нттp⁴⁰⁶
`нттp⁴⁰⁶ - avatar