Results 1 to 3 of 3
  1. #1
    artemff is offline Member
    Join Date
    Dec 2009
    Posts
    41
    Rep Power
    0

    Default How correctly invoke function "round"?

    Why such code don't work?
    Java Code:
    Math M = Math(); 
    PossibleCount = M.round((g.getClipHeight - 40)/20);
    And how correctly do that?

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

    Default

    1. Please clarify "doesn't work". Feel free to use give us as much information as necessary to answer your question.

    2. round is a static method. You don't create a Math object, you simply call the method on the Math class.
    So it's not:
    Java Code:
    Math M = Math(); 
    int foo = M.round(...);

    but instead
    Java Code:
    //Math M = Math(); 
    int foo = Math.round(...);
    Last edited by Fubarable; 01-01-2010 at 05:32 AM.

  3. #3
    artemff is offline Member
    Join Date
    Dec 2009
    Posts
    41
    Rep Power
    0

Similar Threads

  1. Replies: 2
    Last Post: 10-08-2009, 11:28 PM
  2. How "Pattern.matches(regex, input)" function works?
    By kishan in forum Advanced Java
    Replies: 2
    Last Post: 04-26-2009, 12:46 AM
  3. Replies: 2
    Last Post: 01-24-2009, 06:56 PM
  4. Replies: 1
    Last Post: 10-20-2008, 07:35 AM
  5. "this" function in Java
    By mo_mughrabi in forum New To Java
    Replies: 5
    Last Post: 06-02-2008, 12:16 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
  •