How does Java decide when to import?

后端 未结 9 1522
时光取名叫无心
时光取名叫无心 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:05

    every class in java is in a package and if no package is defined then it is understood as in default package. And at the top of the package is java.lang.* so we don't need to import it an require to import other classes.

提交回复
热议问题