Intro
This examples will demonstrates how to display an user home directory. It is quite simple, we can use System.getProperty() method with "user.home" parameter.
Examples
package com.freesamplecode.java.basic;
public class GetUserHomeDirectoryDemo {
public static void main(String[] args){
String homeDirectory = System.getProperty("user.home");
System.out.println("Home Directory : "+homeDirectory);
}
}
Output
Home Directory : C:\Users\Dev

0 comments: