0

I am having trouble figuring how to solve this "cannot find symbol" error. The error is occurring in the line with if (serverNamePart1.length >= 3) { and it saying that serverNamePart1 is the issue.

 public static String getServerName() {

    String serverName = "";

    try {
        serverName = InetAddress.getLocalHost().toString();
        String[] serverNameArray = serverName.split("/");


        if (serverNameArray.length > 0) {

            String serverNamePart1 = serverNameArray[0];

            if (serverNamePart1.length >= 3) {

                switch (serverNamePart1.substring(2, 3).toLowerCase()) {

                    case "r":
                            serverNamePart1.replace("r", "1");
                        break;

                    case "m":
                            serverNamePart1.replace("m","2");
                        break;

                }

            }

0 Answers0