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;
- while(i < personArray.length){
- result += personArray[i];
- i++;
-
- }
-
-
- return result;
- }
-
-
-
- public String forLoop() {
- String result = "";
-
- for(int i = 0; i < personArray.length; i++){
- result += personArray[i];
- }
-
-
- return result;
- }
-
-
-
- public String forEachLoop() {
- String result = "";
- for(Object i : personArray){
- result += String.valueOf(i);
- }
-
- return result;
- }
-
-
- public Person[] getPersonArray() {
- return personArray;
- }
- }
|