subject

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
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 17:30
Working on this program in python 3.7: a year in the modern gregorian calendar consists of 365 days. in reality, the earth takes longer to rotate around the sun. to account for the difference in time, every 4 years, a leap year takes place. a leap year is when a year has 366 days: an extra day, february 29th. the requirements for a given year to be a leap year are: 1) the year must be divisible by 42) if the year is a century year (1700, 1800, the year must be evenly divisible by 400some example leap years are 1600, 1712, and 2016.write a program that takes in a year and determines whether that year is a leap year.ex: if the input is 1712, the output is: 1712 is a leap year. ex: if the input is 1913, the output is: 1913 is not a leap year. your program must define and call the function isleapyear(useryear). the function should return true if the input year is a leap year and false otherwise.
Answers: 1
question
Computers and Technology, 23.06.2019 09:30
Write an essay on online collaboration, how to do it, the challenges, resolving the challenges, and consider whether the risks are greater than rewards. ( need )
Answers: 1
question
Computers and Technology, 23.06.2019 13:30
What is the primary difference between the header section of a document and the body? a. the body is displayed on the webpage and the header is not. b. the header is displayed on the webpage and the body is not. c. the tag for the body is self-closing, but the tags for the headers must be closed. d. the tag for the header is self closing, but the tag for the body must be closed.
Answers: 3
question
Computers and Technology, 23.06.2019 14:30
Choose the answers that best complete each sentence. on average,are more expensive than other kinds of postsecondary schools. the cost of room and board includes. to save money, some students attend auniversity in their home state.
Answers: 2
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
Questions on the website: 13722360