0

Multiple public classes in java?

I think only one top-level public class is accepted per file. But in sololearn there are no errors when we execute code with 2 public classes and program runs fine. How. https://code.sololearn.com/cY9gt1b7vm2I/?ref=app

18th Aug 2021, 2:40 PM
Harshit Jawla
Harshit Jawla - avatar
2 odpowiedzi
+ 1
Sololearn is not 100% java compatible because it execute your code on remote server and code is prepare and modify before it by machine. but it is still acceptable. if you only have one file, it is useful if there can be two public classes together.
18th Aug 2021, 8:15 PM
zemiak
- 2
In sololearn only program as the class name is accepted.
19th Aug 2021, 1:32 AM
Ananya | Inactive |
Ananya | Inactive | - avatar