Results 1 to 6 of 6
  1. #1
    rockstaedy is offline Member
    Join Date
    Sep 2012
    Posts
    8
    Rep Power
    0

    Default call a method from another method in same class

    hi can anyone tell me what im doing wrong i have my main class with 2 methods and want to call the first in the second


    public static String[] ReplaceMore (String x[]) //declaring method
    {
    do{int count1=0; //counter for loop
    count1++; //counter increment
    ReplaceOne(); //name of other method that im trying to import
    }while ( count1 < words[].length); //number of times to loop

    //replaceone cannot be found by the method replacemore
    //error message:method replaceone in class... cannot be applied to given types
    //WHEN RUN ERROR MESSAGE

    Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - missing return statement
    at text.replace.pkg0212.pkg12.TextReplace021212.Repla ceMore(TextReplace021212.java:133)
    at text.replace.pkg0212.pkg12.TextReplace021212.main( TextReplace021212.java:79)
    Java Result: 1

    i know i spelt my username wrong oops
    Last edited by rockstaedy; 10-03-2012 at 01:51 PM. Reason: poor comments

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,949
    Rep Power
    19

    Default Re: call a method from another method in same class

    Please use [code] tags [/code] when posting code.

    WHat error are you getting and on what line?
    Post the exact text.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,193
    Rep Power
    19

    Default Re: call a method from another method in same class

    Recommended reading: Code Conventions for the Java Programming Language: Contents

    Following a convention makes your code easier to read for everyone.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  4. #4
    rockstaedy is offline Member
    Join Date
    Sep 2012
    Posts
    8
    Rep Power
    0

    Default Re: call a method from another method in same class

    sorry for that i am noob have placed in better comments thanks and sorry hope thats better

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,949
    Rep Power
    19

    Default Re: call a method from another method in same class

    And the code tags?
    Most peopale won't bother reading unformatted code...
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  6. #6
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,193
    Rep Power
    19

    Default Re: call a method from another method in same class

    I was referring to using conventional variable names, starting with a lowercase letter. Inane comments only add clutter, so the less the better.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. How can I call a method of this Inner Class?
    By fatabass in forum New To Java
    Replies: 1
    Last Post: 02-05-2012, 01:38 AM
  2. Inner class method call
    By d915172 in forum New To Java
    Replies: 3
    Last Post: 11-11-2010, 09:40 PM
  3. Trying to call a method from sub class
    By TheNewGuy in forum New To Java
    Replies: 4
    Last Post: 10-17-2010, 07:08 AM
  4. How to call a method from another class?
    By jboy in forum New To Java
    Replies: 8
    Last Post: 09-09-2009, 07:29 AM
  5. How to call a class within a method
    By Manfizy in forum New To Java
    Replies: 3
    Last Post: 03-19-2009, 12:34 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
  •