Welcome to the World of Online Learning:
Hello Friends “This blog helps you to learn Java programming concepts. You can learn Java language at your own speed and time. One can learn concepts of Java language by practicing various programs given on various pages of this blog. Enjoy the power of Self-learning using the Internet.”

Write a Java Program to Get Current Working Directory
PROGRAM: Java Program to Get Current Working Directory
/*Java Program to Get Current Working Directory*/
1: Get current working directory
public class CurrDirectory {
public static void main(String[] args) {
String path = System.getProperty("user.dir");
System.out.println("Working Directory = " + path);
}
}
2: Get the current working directory using Path
import java.nio.file.Paths;
public class CurrDirectory {
public static void main(String[] args) {
String path = Paths.get("").toAbsolutePath().toString();
System.out.println("Working Directory = " + path);
}
}