I think it is because you have defined your string "res" inside your while
loop block and returning it outside the block.

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of teddybear
Sent: Thursday, January 22, 2009 6:35 PM
To: Free Java Programming Online Training Course By Sang Shin
Subject: [java programming] Built-in classes problem


Hi..... I seem to have a problem with my static method... The compiler
says that it cannot resolve variable "res" I dunno what to do pls
help.... thnx

here's my code for the static...

public class MyOwnBuiltinClassesProject {

    public static String generateNewName(String[] p){
        int i = 0;
        while(i < p.length){
                String res = p[i].replace(p[i].charAt(1),' ');
                i++;
        }
        return res.trim();
    }


public static void main(String[] args){
         // I didn't start my main yet....
        }
}



--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to