Results 1 to 9 of 9
  1. #1
    abimaran is offline Member
    Join Date
    Nov 2009
    Location
    Colombo, Sri Lanka
    Posts
    22
    Rep Power
    0

    Post Object creation and construstion

    Reason for the result?
    Java Code:
    [COLOR="Red"]class Test {
       Test t;
       int i;
       Test() {
           System.out.println(t + "," + i);
           t = new Test();
           i = 10;
        }
        public static void main(String[] args) {
          Test t = new Test();
           System.out.println(t.t + "," + t.i);
        }
    }[/COLOR]
    Last edited by abimaran; 12-15-2009 at 06:20 AM. Reason: I wrote 4 instead of 'for' - So sorry!

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Your thoughts first?

    edit: I see that you've done this before: dump questions without showing that you've created a thoughtful answer yourself. For your own sake, I ask you to stop doing this. You're only hurting yourself.

  3. #3
    pbrockway2 is online now Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,568
    Rep Power
    12

    Default

    Quote Originally Posted by abimaran View Post
    Reason 4 the result?

    Four isn't the result.

    More seriously I wonder if you mistyped the code from somewhere.

  4. #4
    abimaran is offline Member
    Join Date
    Nov 2009
    Location
    Colombo, Sri Lanka
    Posts
    22
    Rep Power
    0

    Default

    Sir, 4 isn't the result. It's my mistake (just for shorten the language). Now I edit it. Thanks in advanced!

  5. #5
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    You still haven't replied to my post. Sorry to be blunt, but please prove to us that you have more than just two neurons connected by a spirochete.
    Last edited by Fubarable; 12-15-2009 at 06:54 AM.

  6. #6
    abimaran is offline Member
    Join Date
    Nov 2009
    Location
    Colombo, Sri Lanka
    Posts
    22
    Rep Power
    0

    Default

    Sir, I couldn't get the point you said!

  7. #7
    pbrockway2 is online now Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,568
    Rep Power
    12

    Default

    What is the result when you run that code?

  8. #8
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Sir, I couldn't get the point you said!
    Please prove to us that you are not either dumb, careless, or just plain lazy. Please show us that you've at least made an attempt to answer this yourself first before posting a question, any question.

    Is this clear now?
    Last edited by Fubarable; 12-15-2009 at 02:39 PM.

  9. #9
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,165
    Rep Power
    20

    Default

    I can think of one thing that will happen with this, but I'll wait to see what the OP has to say.

Similar Threads

  1. Jar file creation
    By raghu9198 in forum New To Java
    Replies: 4
    Last Post: 01-11-2009, 04:40 AM
  2. bmp creation
    By makpandian in forum New To Java
    Replies: 1
    Last Post: 12-17-2008, 06:33 PM
  3. Java GUI creation help?
    By sabrown311313 in forum New To Java
    Replies: 4
    Last Post: 09-13-2008, 07:28 AM
  4. Object creation and memory issues
    By bugger in forum New To Java
    Replies: 11
    Last Post: 11-29-2007, 01:56 PM
  5. creation of new function
    By an8086 in forum Advanced Java
    Replies: 1
    Last Post: 07-16-2007, 03:20 PM

Posting Permissions

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