This program reads the user name from the system property and display on the console.

Java Code:
public class UserName {

    public static void main(String[] args) {
        String username;
        username = System.getProperty("user.name");
        System.out.println(username);
    }
}