it it is me again. I am know guys are probably thinking am bothersome here is my question. it is about the java game am building no I havent finish it yet, still having some trouble
i have declare this syntax, I know that I have asked this question before but I had forget to mention one thing with it.

Console input = new Console (), the thing the console that have to asterisk on in, I am getting an annoying error that say console() has a private access in Console, - what does that mean and how do i get rid of the error. can it be made public and how do i do that.

many thanks in advance

Yes, the constructor is private to stop you using it.

The API doc fpr Scanner says:

"If this virtual machine has a console then it is represented by a unique instance of this class which can be obtained by invoking the System.console() method. "

.. so that's the right way to get a Console instance

so james do i declare system.console() method and if so how should I declare it.

That's a public method in the System class - you can't declare it!

You just call it, and it gives you a Console object, eg

Console input = System.console();

hi jamescherrill
there are many thing in java that I dont understand can you be patient with me.
why would the constructor stop you from using it and I have now seen you answer and I use it and the error have gone. thank you soooo very much jamescherrill am so sorry that I cant see you to give you a big hug but

system.out.println ("big hug");

I think the constructor is private because the Console object is created when the JVM starts, and you just need to get that instance.

Thnaks for the hug
J :)

go over this, it'll tell you.
BufferendReader api

two remarks, though:
1. this question is not related to the original question in this thread, so you could/should 've asked it in a new thread
2. if the original question really was hard for you to figure out, you should not mess around with BufferedReader just yet. it's better to first have a good grasp of the basics.

This article has been dead for over six months. Start a new discussion instead.