12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
-
- /**
- * Created by leon on 1/24/18.
- */
- public class PersonHandler {
- private final Person[] personArray;
-
- public PersonHandler(Person[] personArray) {
- this.personArray = personArray;
- }
-
- public String whileLoop() {
- String result = "";
- int i = 0;
- int arr = personArray.length;
- while(i < arr){
- result += personArray[i].toString();
- i++;
-
- }
-
- return result;
- }
-
-
- public String forLoop() {
- String result = "";
- int arr = personArray.length;
-
- for(int i = 0; i < arr; i++){
- result += personArray[i].toString();
- }
-
-
- return result;
- }
-
-
- public String forEachLoop() {
- String result = "";
-
- int arr = personArray.length;
- int currentPerson;
-
- for(Person people : personArray ){
- result += people.toString();
- }
- return result;
- }
-
- public Person[] getPersonArray() {
- return personArray;
- }
- }
|