Scala的导入

复制代码
复制代码
//导入
//(1) 创建包:在src上右键,新建软件包
//(2)填写包名:小写
//(3)在包上右键,创建类。自动加入包名
//(4)导入。import 包名.类名
//导入多个类
//import jh.yuanlixueyuan.bigdata.scala03.{A,B,C}
//导入包下的所有的类
//import jh.yuanlixueyuan.bigdata.scala03._
//import com.group1.Student

//把导入的成员重新改个名字
//格式:import 包名.{旧名字=>新名字}
//import com.group1.Student
//import jh.yuanlixueyuan.bigdata.scala03.{C=>c}

//导入所有,排除一部分
//import  jh.yuanlixueyuan.bigdata.scala03.{C=>_,_}
object Test23 {
  def main(args: Array[String]): Unit = {
//    new A()
//    new B()
//    new C()
    //    val s1=new Student()
    //    s1.run()
    //    var s2 =new A()
    //    var s3 =new B()
    //    var s4 =new C()
    def test(): Unit = {
      //  //局部导入
      //  import jh.yuanlixueyuan.bigdata.scala03._
      //  new A()
      //}
      //    def test1(): Unit ={
      //      println("111")
      //      new A()
      //    }
      //    test()
      //  }
    }
  }
}
相关推荐
ZC跨境爬虫38 分钟前
跟着 MDN 学 JavaScript day_2:JavaScript 初体验
开发语言·前端·javascript·学习·ecmascript
金銀銅鐵42 分钟前
用 Tkinter 实现一个简单的罗马数字转化工具
后端·python
Jun6261 小时前
QT(3)-线程中使用控件
开发语言·qt
xiaoshuaishuai81 小时前
C# AvaloniaUI ProgressBar用法
开发语言·c#
咋吃都不胖lyh1 小时前
LangGraph标准构建示例
开发语言·python
Jun6261 小时前
QT(1)-C/C++库生成和调用
c语言·开发语言·c++·qt
RemainderTime1 小时前
Spring Boot脚手架集成 Spring Security实现生产级RBAC鉴权
spring boot·后端·spring
Jun6261 小时前
QT(10)-TCP数据收发
开发语言·qt·tcp/ip
*neverGiveUp*2 小时前
Python基础语法
开发语言·python
用户2330713074792 小时前
对象的一生(上)
后端