Results 1 to 3 of 3
  1. #1
    81102371 is offline Member
    Join Date
    Sep 2014
    Posts
    1
    Rep Power
    0

    Default Meaning of 'this' in constructor

    Dear kaydell2
    what does ((call itself)) mean? I'm beginner in java. what is the difference between first three this and the last ( which we can not write "this" ) and have to write setTime? maybe I don't know what does ((this)) exactly do in each constructor!

    Quote Originally Posted by kaydell2 View Post
    The constructor with three parameters was calling itself. I commented it out.


    public Tuna(int h,int m,int s){
    // this(h,m,s); <<<<< this constructor can't call itself.
    setTime(h,m,s);
    }

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    12,059
    Rep Power
    25

    Default Re: Meaning of 'this' in constructor

    Removed from http://www.java-forums.org/new-java/...tors-help.html

    Don't post to long-dead threads and don't hijack another poster's thread. When you have a question, start your own topic.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    12,059
    Rep Power
    25

Similar Threads

  1. Error meaning
    By Johanis in forum New To Java
    Replies: 2
    Last Post: 10-16-2012, 10:11 AM
  2. Replies: 5
    Last Post: 08-11-2012, 09:50 AM
  3. The meaning of replaceAll
    By herolua in forum New To Java
    Replies: 4
    Last Post: 10-07-2011, 05:18 AM
  4. for loop meaning
    By ahmakki in forum New To Java
    Replies: 3
    Last Post: 04-12-2010, 01:06 AM
  5. Exception:Meaning
    By tiger100plus in forum New To Java
    Replies: 2
    Last Post: 11-27-2008, 07:45 AM

Posting Permissions

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