Java Error: Should be declared in a file named

前端 未结 6 1883
说谎
说谎 2020-12-31 23:21

I\'m fairly new to Java and trying to figure out how to solve the following error:

Error reads

CalculatorWithMemory.java:1: class Calculator is publi         


        
6条回答
  •  再見小時候
    2020-12-31 23:26

    If you want more than one class in the same file then you are supposed to be writing only one class to be public which has same name as file.

    All the other classes you can define as "class abc{}" or using other modifier then public.

提交回复
热议问题