小编And*_*rew的帖子

Java的.对象数组

问题是:我有一个代码

public class Component {
public Component() {
// TODO Auto-generated constructor stub
 }
 public double[] Shifts ;
 public double[][] Couplings ;

}

public class Decouplage {
 public Decouplage(double[] GroupShifts, double[][] GroupCoup) {
  AllComponents = new Component(); 
  AllComponents.Shifts = GetShifts(...blah-blah-bla...);
  AllComponents.Couplings = GetGouplings(...blah-blah-bla...);
 }

public Component AllComponents ; 
}
Run Code Online (Sandbox Code Playgroud)

有用.但是当我尝试创建这个类Component的数组AllComponents [10]时

 public class Decouplage {
 public Decouplage(double[] GroupShifts, double[][] GroupCoup) {
  AllComponents = new Component()[nComponents]; /////HOW MUST I PUT IN ONE LINE THE NUMBER OF ELEMENTS AND THE () FOR …
Run Code Online (Sandbox Code Playgroud)

java arrays object

4
推荐指数
1
解决办法
2万
查看次数

标签 统计

arrays ×1

java ×1

object ×1