Styrow.dev
Question 10 of 247
Java Topic: General medium

Can we put more than one public class in single java file?

Question

Can we put more than one public class in single java file?

Answer

No, we cannot. Because, when we declare a class as public, then we have to save the java file with same name as the name of the public class.