Results 1 to 3 of 3

Thread: Java Help - "The name is Null"??

  1. #1
    Join Date
    Oct 2012
    Location
    Porto, Portugal
    Posts
    218
    Mentioned
    0 Post(s)
    Quoted
    42 Post(s)

    Default Java Help - "The name is Null"??

    Hi. It's me again

    I have this:

    4oEqP.png

    4oEqY.png

    I get that error down in that box. Why is it returning null?



    OFFTOPIC: How do I end the script in java, like here we do TerminateScript.


    Thanks

  2. #2
    Join Date
    Jun 2008
    Location
    United States
    Posts
    818
    Mentioned
    60 Post(s)
    Quoted
    90 Post(s)

    Default

    In your banana constructor:

    Code:
    name = thisname;
    your are assigning thisname's value to the parameter. Since thisname is never initialized the parameter's value is being set to null. That is beside the point, as what you have done is flipped around your assignment statement. Should be:

    Code:
    thisname = name;
    Also, you can call the 'thisname' variable 'name' and do something like:

    Code:
    this.name = name;
    To terminate a Java program you can use

    Code:
    System.exit(0);
    [10/14/13:19:03] <BenLand100> this is special relatively, just cleverly disguised with yachts

  3. #3
    Join Date
    Oct 2012
    Location
    Porto, Portugal
    Posts
    218
    Mentioned
    0 Post(s)
    Quoted
    42 Post(s)

    Default

    Quote Originally Posted by euphemism View Post
    In your banana constructor:

    Code:
    name = thisname;
    your are assigning thisname's value to the parameter. Since thisname is never initialized the parameter's value is being set to null. That is beside the point, as what you have done is flipped around your assignment statement. Should be:

    Code:
    thisname = name;
    Also, you can call the 'thisname' variable 'name' and do something like:

    Code:
    this.name = name;
    To terminate a Java program you can use

    Code:
    System.exit(0);

    Thank you

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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