In the Collection-Iterator project, a main java class "OysterMonths"
is created.

Under the main, a class instance is created
OysterMonths om = new OysterMonths();

My question is why is there such a need to create? Can't I just simply
call another method to perform the same job?

In the lesson'ss example, I need to write 4 statements in the main
method:
OysterMonths om = new OysterMonths();
DateFormatSymbols dfs = new DateFormatSymbols();
String[] monthArray = dfs.getMonths();
Collection  months = Arrays.asList(monthArray);
om.safeMonths = om.filter(months);

To me, I can just have 3 statements, without creating the class
instance.
DateFormatSymbols dfs = new DateFormatSymbols();
String[] monthArray = dfs.getMonths();
Collection  months = Arrays.asList(monthArray);
safeMonths = filterMethod(months); // calling a method

Please advise. Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"JPassion.com: Java Programming" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jpassion_java?hl=en.

Reply via email to