Two public classes in one file java

前端 未结 5 746
青春惊慌失措
青春惊慌失措 2020-12-09 17:58

Ok, this might be kiddies question in java. We can\'t define two public classes in one file. But, in one of the examples from the book SCJP study guide, this example was men

5条回答
  •  天涯浪人
    2020-12-09 18:46

    you can make 2 public classes in one file , inside a class that contains them .

    it's also recommended to add "static" for them , if you do not need any reference to the container class .

提交回复
热议问题