File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Console c = System.console();" Watch "Console c = System.console();" New topic

Console c = System.console();

shivang sarawagi
Ranch Hand

Joined: Jun 19, 2008
Posts: 149

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

Joined: Jan 10, 2002
Posts: 63532

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

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Console c = System.console();
jQuery in Action, 3rd edition