线程main java中的异常怎么解决_java - 如何修复“ main”线程java.lang.NullPointerException中的异常? [重复] - 堆栈内存溢出...

我是Java编程的初学者。 我知道有关此特定消息错误的主题数量,但我无法解决此问题。 在下面的代码中,该错误指示在第23行中。 我知道问题似乎与空引用有关,但是我看不到方法“ Recommander”如何不为所有引用分配值。

公共班指挥官{

// predetermined array of series

private String[] serie= {"Friends S1","Friends S2",

"Friends S6","Friends S7", "Friends S8", "How I met your mother S1",

"How I met your mother S2","How I met your mother S3 ","Castle S3",

"Santa Clarita Diet S1", "Modern Family S1","Modern Family S2",

"Family Guy S6", "The Simpsons S5"};

// array of the purchases of one customer

private int[] profil ;

//number of profiles in the database

private int nbProfils = 10 ;

// array of all the profiles from the database and the series available

private int[][] records ;

// creation of an instance of the object Recommander

public Recommander() {

for (int k=0;k<=nbProfils-1; k++) {

for (int i=0; i<=serie.length-1;i++) {

records[k][i]= (int) (Math.random())*2 ;

}

}

}

// Display of the series available in store

public String affichageSerie() {

String Affichage = "" ;

for (int i = 0 ; i<=serie.length-1; i++) {

Affichage = Affichage + serie[i] + "\n" ;

}

return Affichage ;

}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值