This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Console c = System.console(); Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Console c = System.console();" Watch "Console c = System.console();" New topic
Author

Console c = System.console();

shivang sarawagi
Ranch Hand

Joined: Jun 19, 2008
Posts: 147


can anyone explain the logic of this line, we generally used
for example



which creates an object on the heap and assigns it to the reference a, but i don't understand
what is happening in the below line



why can't we say Console c= new Console();
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60774
    
  65

Have you checked the javadoc for the System.console() method?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
Don't get me started about those stupid light bulbs.
 
subject: Console c = System.console();
 
Similar Threads
Console.reader.close() misunderstanding
console problem
doubt in console class
confused with in.readLine();
Netbeans IDE 6.1 Compilation fail