0
Whenever i m declaring class A as public.. it is showing error..why?
class A { A(){} void d() { System.out.print("hi"); } } class Mcq33 extends A { public static void main(String args[]) { A r=new A(); r.d(); } void d() { System.out.print("bye"); } }
2 Answers
+ 4
There must be only one public class in a Java file
https://www.quora.com/Can-we-keep-more-than-one-class-in-a-single-java-file
+ 3
if I am not mistaken sololearn allow it, maybe sololearn handle the code in different file