Results 1 to 5 of 5
  1. #1
    jwl
    jwl is offline Member
    Join Date
    Jul 2012
    Posts
    93
    Rep Power
    0

    Default java method help

    I am behind on my understanding of methods

    if I have this

    Java Code:
    public void CreateRandomTriangles(int numTriangles){
    The code inside the method creates three random x and y coordinates that when connected will make a triangle. I already did that part.
    What does int numTriangles do?

    Also if I wanted to print out the coordinated in another method such as
    Java Code:
    private void TestTriangles() {
     System.out.println(x1......y3)}
    why wont the console display the string?

    I'm calling the big method which encapsulates the two methods above.

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,963
    Rep Power
    8

    Default Re: java method help

    You're going to have to post an SSCCE that demonstrates exactly what you're talking about. We can't help you figure out what things do if you don't post what the things are doing!
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    jwl
    jwl is offline Member
    Join Date
    Jul 2012
    Posts
    93
    Rep Power
    0

    Default Re: java method help

    don't have enough time

  4. #4
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,963
    Rep Power
    8

    Default Re: java method help

    Quote Originally Posted by jwl View Post
    don't have enough time
    Good luck then. You haven't posted anything that is answerable.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  5. #5
    PhQ's Avatar
    PhQ
    PhQ is offline Senior Member
    Join Date
    Mar 2010
    Location
    Lithuania
    Posts
    358
    Rep Power
    5

    Default Re: java method help

    As for your first question,
    numTriangles is a parameter. You use it to pass a variable to a method.
    Read this: Defining Methods (The Java™ Tutorials > Learning the Java Language > Classes and Objects) .

Similar Threads

  1. Java script call to a Java method
    By mitchj in forum New To Java
    Replies: 5
    Last Post: 04-26-2012, 05:54 PM
  2. Java method
    By javasm in forum New To Java
    Replies: 5
    Last Post: 03-16-2012, 01:42 PM
  3. Java Method Problems
    By sstokes76 in forum New To Java
    Replies: 3
    Last Post: 02-15-2011, 07:45 AM
  4. Call Java Method in MS SQL
    By mexyz in forum New To Java
    Replies: 19
    Last Post: 02-17-2010, 01:38 PM
  5. Replies: 3
    Last Post: 02-09-2010, 05:22 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
  •