I have some JAVA code like the next:
public class DataModel {
public DataModel(OtherDataModel someObject) {
System.out.println(someObject);
}
}
Debug Output:
someObject
--someOtherObject
--ArrayList (related to someOtherObject)
I need to iterate over someObject to get an output like this:
someOtherObject
-id
-name
-dates (of ArrayList)
--date1
--date2
--dateN
-description
-etc
What is the best way to do this?
From main method, create an object of your class and past that object as a parameter. After that you can access the properties of the object by using getting method.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.