簡體   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