Results 1 to 2 of 2
Like Tree1Likes
  • 1 Post By andy-grom

Thread: What does it mean?

  1. #1
    hawk-dc is offline Member
    Join Date
    Nov 2013
    Rep Power

    Default 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.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!

  2. #2
    andy-grom is offline Member
    Join Date
    Dec 2013
    Rep Power

    Default 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).
    hawk-dc likes this.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts