var channelsNumber = track.getNumberOfChannels()
var framesNumber = lastFrame - firstFrame
var frames = Array.ofDim[Int](channelsNumber)(framesNumber)
System.out.println(frames.length);
System.out.println(frames.length);
我嘗試定義整數的二維數組。我得到這個錯誤:斯卡拉多維陣列一次
[error] .../test.scala:58: type mismatch;
[error] found : Int
[error] required: scala.reflect.ClassManifest[Int]
[error] var frames = Array.ofDim[Int](channelsNumber)(framesNumber)
[error] ^
[error] one error found
什麼是「scala.reflect.ClassManifest [Int]」?爲什麼channelsNumber傳遞和framesNumber,這也是一個整數不?
謝謝!奇怪的是,它與Array.ofDim [Int](4)(4)正常工作,但它沒有與變量。 – ciembor
當我在repl中運行代碼'Array.ofDim [Int](4)(4)'時,我得到了同樣的錯誤'type mismatch' ... – coubeatczech