Java Programming Help
Posted
by user215049
on Stack Overflow
See other posts from Stack Overflow
or by user215049
Published on 2010-05-27T20:33:34Z
Indexed on
2010/05/27
20:41 UTC
Read the original article
Hit count: 124
hi, im a bit confused on this and i dont know how to solve this question that i have been asked, id be grateful if you could assist me on this question, maybe try to tell me what needs to be done, and how. the question is:
Write a method called countChars which takes an InputStream as a parameter, reads the stream and returns the number of characters it contains as an int. Any IOExceptions which might occur in the method should be passed back to the method's caller.
Note that the method header should show that it is possible that an exception might occur.
i attempted this question with the following code:
public class countChars
{
public int countChars(int InputStream)
{
return InputStream;
}
}
and i get an error message saying :
Main.java:26: cannot find symbol
symbol : method countChars(java.io.InputStream)
location: class Main
s1 = "" + countChars(f1);
^
1 error
© Stack Overflow or respective owner