Wednesday 25 January 2012

core java

/**
* This class demonstrates how to find the current logged in user on the system
* in Java.
*
*/
public class CurrentLoggedUser {

    public void getCurrentLoggedInUser() {

        String currentLoggedInUser = System.getProperty("user.name");
        System.out.println("The Current Logged In User Is: " + currentLoggedInUser);
    }

    public static void main(String[] args) {
        new CurrentLoggedUser().getCurrentLoggedInUser();
    }
}