Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Calling another method on my code

  1. #1
    Junior Member
    Join Date
    Jun 2012
    Posts
    2
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Calling another method on my code

    How do I call another static method?

    i have public static String generateMutatedStringReduced(String source, double rate) on string mutatedDna

        public Chromosome mutate()
        {
            String mutatedDna = GARandom.generateMutatedStringReduced(dna, 0.1);// 10% probability of change per character
            return new Chromosome(mutatedDna);
        }

    i would also like to call on the string mutatedDna

    public static String generateMuatedLengthString(String original, double rate)


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,290
    Thanks
    56
    Thanked 2,373 Times in 2,344 Posts

    Default Re: Calling another method on my code

    The syntax to call a static method is to use the class name dot method name:
    double val = Math.abs(12.3); // Call the static method abs in the Math class
    If you don't understand my answer, don't ignore it, ask a question.

  3. The Following User Says Thank You to Norm For This Useful Post:

    Caliichick (June 12th, 2012)

  4. #3
    Junior Member
    Join Date
    Jun 2012
    Posts
    2
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: Calling another method on my code

    I know how to call it, but how do I two of them at the same time?

  5. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,290
    Thanks
    56
    Thanked 2,373 Times in 2,344 Posts

    Default Re: Calling another method on my code

    how do I two of them at the same time?
    You can't call two methods at the same time. You have to call them one at a time.

    Can you explain what you are trying to do?
    Last edited by Norm; June 12th, 2012 at 06:03 PM.
    If you don't understand my answer, don't ignore it, ask a question.

  6. The Following User Says Thank You to Norm For This Useful Post:

    Caliichick (June 12th, 2012)

Similar Threads

  1. Calling method cant get the parameters right
    By frozen java in forum What's Wrong With My Code?
    Replies: 3
    Last Post: October 22nd, 2011, 03:23 PM
  2. calling a method from other object: thred
    By Sudheera in forum What's Wrong With My Code?
    Replies: 2
    Last Post: July 18th, 2011, 06:19 AM
  3. [SOLVED] method calling
    By javapenguin in forum What's Wrong With My Code?
    Replies: 2
    Last Post: November 4th, 2010, 02:43 AM
  4. Help Calling Method From Another Class
    By CheekySpoon in forum What's Wrong With My Code?
    Replies: 2
    Last Post: February 15th, 2010, 10:24 AM
  5. Java Code Help - Calling Method
    By KevinGreen in forum Object Oriented Programming
    Replies: 5
    Last Post: September 18th, 2009, 01:55 AM