This example show you how to get operating system active user’s login name. We can obtain the username of current user by reading system properties using the user.name
key.
package org.kodejava.lang;
public class GettingUserName {
public static void main(String[] args) {
String username = System.getProperty("user.name");
System.out.println("username = " + username);
}
}
Latest posts by Wayan (see all)
- How do I create a string of repeated characters? - September 1, 2023
- How do I convert datetime string with optional part to a date object? - August 28, 2023
- How do I split large excel file into multiple smaller files? - April 15, 2023