什么包1)Java和2)Groovy自动导入? [英] What packages does 1) Java and 2) Groovy automatically import?

查看:213
本文介绍了什么包1)Java和2)Groovy自动导入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Groovy中编写了很多程序后,我知道某些包中的类会自动导入。什么是1)Java和2)Groovy的独家报道?
是否有一个确定的列表,你不需要为每种语言指定一个导入?

解决方案

<在Java中,默认导入的唯一软件包是

  java.lang。* 


根据 href =http://groovy.codehaus.org/Differences+from+Java =noreferrer>这里,groovy的包裹清单是

  java.io. * 
java.lang。*
java.math.BigDecimal
java.math.BigInteger
java。 net。*
java.util。*
groovy.lang。*
groovy.util。*


Having programmed in Groovy quite a bit I know classes in certain packages are automatically imported. What's the scoop for 1) Java and 2) Groovy? Is there a definitive list of ones you don't need to specify an import for for each of these languages?

解决方案

In Java, the only package imported by default is

java.lang.*

This is where objects such as String and Object reside.

According to here, the list of packages for groovy are

java.io.*
java.lang.*
java.math.BigDecimal
java.math.BigInteger
java.net.*
java.util.*
groovy.lang.*
groovy.util.*

这篇关于什么包1)Java和2)Groovy自动导入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆