How does Java decide when to import?

后端 未结 9 1485
时光取名叫无心
时光取名叫无心 2020-11-27 20:55

Why doesn\'t Java need to import classes like Integer, String, etc. while it needs to import other classes?

9条回答
  •  眼角桃花
    2020-11-27 21:19

    Because, they belongs to java.lang.* package. And, it is implicitly import by the compiler. If you do, then it won't complain you.

提交回复
热议问题