-
What does it mean?
Im still studying java and there is:
public static void printDate (MoreDates t){
MoreDates t1= new MoreDates (2012, 11, 9);
System.out.println (t.month + ", " + t.day + ", "+ t.year);
so whats the difference between "MoreDates t" in the first row and an object "MoreDates t1" which is in the second one?
Thanks in advance!
-
Re: What does it mean?
Firstly, you should use <code>-tags in order to make your Java code easier to read!
Regarding your question: In the first row, there is a method parameter called t which is an instance of MoreDates. In the second row, you are creating an object of that class yourself with fixed values.
The difference is that the object represented by t might be any instance of MoreDates with any data passed by you or another programmer using your function.
This is one aspect that makes Java programming so powerful and flexible.
If there are still some open questions, please ask (but this time more precisely).