0
Please someone correct me
5 Respostas
+ 2
Hey, there! RYLE RAVEN
We can declare ONLY ONE top level public class in a Java file. If we are trying to create more than one public class in a java file then we will get a compile time error.
Two top level public classes are not allowed in one file because public classes must have the same name as the source file.
In your code, Sub_class is public but it's under the file named Super_Class.java. That's why you're getting a compile time error that says "Sub_class should be declared in a file named Sub_class.java"
+ 7
Might help you!
https://www.codesdope.com/java-subclass/
+ 5
RYLE RAVEN
Remove public keyword from class Sub_class
+ 1
Thanks 👍
+ 1
You're welcome 😊