4th Dec 2020, 6:02 AM
RYLE RAVEN
RYLE RAVEN - avatar
5 odpowiedzi
+ 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"
4th Dec 2020, 7:17 AM
Minho
Minho - avatar
4th Dec 2020, 7:06 AM
Piyush
Piyush - avatar
+ 5
RYLE RAVEN Remove public keyword from class Sub_class
4th Dec 2020, 6:16 AM
A͢J
A͢J - avatar
+ 1
Thanks 👍
4th Dec 2020, 8:29 AM
RYLE RAVEN
RYLE RAVEN - avatar
+ 1
You're welcome 😊
4th Dec 2020, 8:32 AM
Minho
Minho - avatar