View Single Post
Old Jan 11th, 2007, 1:58 PM   #1
fresher
Newbie
 
Join Date: Dec 2006
Posts: 13
Rep Power: 0 fresher is on a distinguished road
accepting user input

Hi all, i've this code below which prompts a user to select from a list of ip addresses.e.g 192.168.2.1....etc. Now i wona modify this code so that if the machine on which the program is run has a different network part (192.168.2.) then I can prompt the user to enter their network ID e.g (148.145.23.) then increment the last bit using a for loop. Anyone able to help me out pls? thanks in advance

I have added this block of code below in order to do this but it doesnt work:
System.out.print("Enter your network part or hit enter to proceed: ");
            String network = in.readString();
            
            //test
            System.out.println(network);
            
            //if enter is pressed - same network
            if (network == null)
        
            {
            
            System.out.print("SELECT A MACHINE TO VIEW FROM LIST: ");
            int choice = in.readInteger();
            }

            else
            {
                //pass new network part to ip string variable
                ip = network;
            }

nb: this code is part of my previous post on ' passing a string to a variable.....' click here to view full code:http://www.programmingforums.org/for...-variable.html
any help appreciated.
fresher is offline   Reply With Quote