I have this class:
public class MyClass{
private Test test;
public class Test{
int num;
String color;
public Test(int num, String color){
this.num = num;
this.color = color;
}
}
public MyClass(){
}
public void setNum(int number){
test.num = number;
}
public void setColor(String color){
test.color = color;
}
public Test getTest(){
return test;
}
}
I am setting the values from another class and at the end I call the method getTest:
MyClass myclass = new MyClass();
.
.
.
Test test1 = myclass.getTest();
I want to Iterate the object test1 to get the values. Is that possible? Do I have to implement hasNext() method inside the class MyClass? If yes, how can I do it?