Results 1 to 1 of 1
Thread: Getting current user’s name
-
Getting current user’s name
We cannot instantiate the System class because its final and all its constructors are private. All the variables and methods of System class are static. Following example gets and displays the current logged in user name.
Java Code:class UserName { public static void main(String[] args) { String name; name = System.getProperty("user.name"); System.out.println(name); } }
Similar Threads
-
How to get Current Directory through File
By Java Tip in forum java.ioReplies: 0Last Post: 04-05-2008, 10:14 AM -
Current month
By Java Tip in forum Java TipReplies: 0Last Post: 01-07-2008, 08:40 AM -
how to get the current date and time
By valery in forum New To JavaReplies: 1Last Post: 08-03-2007, 06:05 PM -
How to get the current working directory in EJB?
By sathish_2111 in forum Enterprise JavaBeans (EJB)Replies: 1Last Post: 07-19-2007, 04:24 PM -
How can i get current directory?
By Ashley in forum New To JavaReplies: 1Last Post: 05-26-2007, 01:21 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks