This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Please help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Please help" Watch "Please help" New topic

Please help

pravink chougule

Joined: Jan 18, 2007
Posts: 9
* There was a qs with a character array being declared as a class member as :

Char ch[] = new Char[4] .

This was not initailized anywhere . But this was used to acess the fle data with a reader as follows :

While(ch = (int) != -1){



the file contained abcdef






Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
"There was a qs "

Please tell us exactly where you have got this question.
Also please edit your question title to something more meaningful than "please help". Thanks.

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
pravink chougule

Joined: Jan 18, 2007
Posts: 9
It was in one of the questions asked in one of the company interview exam...
Will appreciate if you could give me the answer for the same..
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
The whole question looks like nonsense to me. What is the out on which the method read is called? And what is Char? Is it some special wrapper class? And While that's not even a Java keyword. And it's trying to assign an int to an array reference. Looks like that company is just trying to waste peoples time.
Henry Wong

Joined: Sep 28, 2004
Posts: 20380

To be fair, it was an "interview exam". Something tells me that most of the "nonsense" is probably because it is from memory. Regardless, I agree with Barry, the question in its current incomplete state, just "waste peoples time".


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Gudimella Chandana

Joined: Dec 28, 2006
Posts: 7
Hi Pravin,

While posting questions please verify whether you are posting them correctly or not.

The above code result in compiler error. First of all check the Statement what you are trying to assign to what and what you are checking and what the method will be returning.
Secondly there is no method in the inputstream which takes the char array as an argument.

Try out with the above code.
I agree. Here's the link:
subject: Please help
jQuery in Action, 3rd edition