Page 2 of 2 FirstFirst 12
Results 21 to 23 of 23
Like Tree3Likes

Thread: Using methods within methods

  1. #21
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    4,025
    Rep Power
    6

    Default Re: Using methods within methods

    Yep. Hadn't considered the total containment case.

    Regards,
    Jim
    Stud1 likes this.
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  2. #22
    Stud1 is offline Member
    Join Date
    Jan 2014
    Posts
    44
    Rep Power
    0

    Default Re: Using methods within methods

    Quote Originally Posted by jim829 View Post
    And in your contains method, just return the value of the expression. No ifs are needed.
    How do you mean here? Since it's a boolean method, it must return a boolean value which is either true or false. How should I write if not using if()?

  3. #23
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    4,025
    Rep Power
    6

    Default Re: Using methods within methods

    Here is what I mean:
    Java Code:
    return px >= x && px <= x + side && py >= y && py <= y + side;
    The expression evaluates to either true or false. So jut return that.

    Regards,
    Jim
    Stud1 likes this.
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 1
    Last Post: 07-13-2012, 12:04 AM
  2. Replies: 2
    Last Post: 07-13-2012, 12:04 AM
  3. Replies: 8
    Last Post: 04-17-2012, 12:00 AM
  4. Java Noob, trying to call methods from another methods
    By gabrielpr12 in forum New To Java
    Replies: 8
    Last Post: 11-17-2011, 10:07 PM
  5. Replies: 1
    Last Post: 10-23-2011, 01:37 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
  •