繁体   English   中英

除了 java.lang 包之外还有什么在 JShell 中自动导入?

[英]What other than java.lang packages are imported automatically in the JShell?

I've observed that in the JShell session, not only package "java.lang", but quite a few other packages (that are not imported automatically in the Java class files, eg LinkedList , Math and several other types) seem to be imported , 默认。

我想知道,默认情况下,JShell session 中还有哪些其他包可用,以及与普通 class 文件区别的原因是什么?

我在JEP 222上找不到任何东西,既不是这种自动/隐式导入的动机,也不是 - 实际导入的文档。

您可以运行/import来找出:

jshell> /import
|    import java.io.*
|    import java.math.*
|    import java.net.*
|    import java.nio.file.*
|    import java.util.*
|    import java.util.concurrent.*
|    import java.util.function.*
|    import java.util.prefs.*
|    import java.util.regex.*
|    import java.util.stream.*

https://docs.oracle.com/en/java/javase/11/tools/jshell.html

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM