![subject](/tpl/images/cats/informatica.png)
Computers and Technology, 06.05.2020 07:12 Damani14
Can someone tell me what's wrong here? I'm starting at the index of 0, but getting this error.
import java. util.*;
import java. io.*;
public class Person{
private String person;
private String mother;
private String father;
private String [] array;
public Person (String person, String mother, String father, String [] array){
this. person = person;
this. mother = mother;
this. father = father;
this. array = array;
if (mother. equals("n/a")){
mother = "not found";
}
if (father. equals("n/a")){
father = "not found";
}
}
public String getPerson (){
return this. person;
}
public String getMother (){
return this. mother;
}
public String getFather (){
return this. father;
}
public String [] getKids (){
String [] kids = {"","","","",""};
for (int i = 0; i < array. length - 1; i++){
String name = array[i];
kids[i] = name;
}
return array;
}
}
My error:
Exception in thread "main" java. lang.: Index 3 out of bounds for length 3
at Person. getKids(Person. java:62)
at FamilyTree. getKidsLine(FamilyTree. java:129)
at FamilyTree. printFamilyTree(FamilyTree. java:73)
at FamilyTreeClient. main(FamilyTreeClient. java:10)
![ansver](/tpl/images/cats/User.png)
Answers: 2
![](/tpl/images/ask_question.png)
![](/tpl/images/ask_question_mob.png)
Other questions on the subject: Computers and Technology
![image](/tpl/images/cats/informatica.png)
Computers and Technology, 22.06.2019 15:00, 2alshawe201
The three logical operators used to write compound conditions are "and," "or," and "not." a: true b: false
Answers: 2
![image](/tpl/images/cats/informatica.png)
Computers and Technology, 22.06.2019 22:30, juliangarcia0002
Which of the following factors would your hypothetical supervisor look at when deciding whether to test a biological material sample for dna? the amount of other evidence you have implicating a suspect in a crime the annual budget for the crime lab both of the above none of the above; you would almost always order a test
Answers: 3
![image](/tpl/images/cats/informatica.png)
![image](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 06:30, arguellesjavier15
Who can provide you with a new password when you have forgotten your old one? your provide you with a new password in case you forget your old one.
Answers: 3
You know the right answer?
Can someone tell me what's wrong here? I'm starting at the index of 0, but getting this error.
Questions in other subjects:
![Konu](/tpl/images/cats/es.png)
![Konu](/tpl/images/cats/mat.png)
Mathematics, 03.06.2020 14:03
![Konu](/tpl/images/cats/istoriya.png)
History, 03.06.2020 14:03
![Konu](/tpl/images/cats/himiya.png)
Chemistry, 03.06.2020 14:03
![Konu](/tpl/images/cats/mat.png)
![Konu](/tpl/images/cats/mat.png)
![Konu](/tpl/images/cats/mat.png)
Mathematics, 03.06.2020 14:03
![Konu](/tpl/images/cats/mat.png)
Mathematics, 03.06.2020 14:03
![Konu](/tpl/images/cats/en.png)
English, 03.06.2020 14:03
![Konu](/tpl/images/cats/mat.png)
Mathematics, 03.06.2020 14:03