• 2024-11-20Scala之Array数组
     可修改的Arrayimportscala.collection.mutable.ArrayBuffer//Array:数组//可修改的:ArrayBuffer//不可修改的:ArrayobjectTest1{//可修改的:ArrayBufferdefmain(args:Array[String]):Unit={//1.新建valarr1=ArrayBuffer(1,2,3)//2.添加
  • 2024-11-19Scala(多维数组)
    最典型的的多维数组就是二维数组。objecttest3{defmain(args:Array[String]):Unit={//二维数组//2.1创建方式1valarr5=Array.ofDim[Int](2,2)//2行2列//2.2访问数组的元素arr5(0)(0)=1arr5(0)(1)=2arr5(1)(0)=3