Regarding taking the absolute path from the user
<p>I have one query is that I have developed a program that ask from user to enter the drive( c: d:) and the folder name and based on these parameters it calculates the lines of code in that folder of all the files inside that folder but now the problem is lets say one user has kept the folder in C:\Test\ and other user has kept the folder in C:\abc\Test\ so nesting could happen , so to solve this issue ,I was thinking of the logic that to take full absolute path from the user itself , and based on that absolute path my current program will work , please advise how to achieve this, my present logic is</p>

<pre><code>public class FileCountLine {


    public static void main(String[] args) throws FileNotFoundException {


        Scanner in=new Scanner(System.in);
        System.out.println("Enter the Drive name like C,D,E etc");
        String drive=in.next();
        System.out.println("Enter the main folder name");
        String main_folder=in.next();
        File directory=new File(drive+":"+"//"+main_folder+"//");

    Map&lt;String, Integer&gt; result = new HashMap&lt;String, Integer&gt;();
        //File directory = new File("C:/Test/");
        File[] files = directory.listFiles();
        for (File file : files) {
            if (file.isFile()) {
                Scanner scanner = new Scanner(new FileReader(file));
                int lineCount = 0;
                try {
                    for (lineCount = 0; scanner.nextLine() != null; lineCount++);
                } catch (NoSuchElementException e) {
                    result.put(file.getName(), lineCount);
                }
            }
        }       

        for( Map.Entry&lt;String, Integer&gt; entry:result.entrySet()){
              System.out.println(entry.getKey()+" ==&gt; "+entry.getValue());
            }   


        /*Set s=result.entrySet();
        Iterator itr=s.iterator();
        while(itr.hasNext())
        {
            Map.Entry m=(Map.Entry)itr.next();
            System.out.println(m.getKey()+"--&gt;"+m.getValue());
         }*/

            }
}
</code></pre>

<p>Please advise how to add the logic of taking the full absolute path from the user and then working on that absolute path . please advise</p>

<p>One more thing is that I was thinking is that from the user will enter the complete path lets say c:/abc/def/Test and that we will accept it as string and based on that we will continue with our existing logic , please advise</p>
