All:
I am also having difficulty understanding what we are trying to
achieve. I do not understand why we need two more classes. If the
goal is to create the output file all in upper case, then why would we
not just check the int from the read and subtract 32 like this:
int c;
while ((c = in.read()) != -1)
out.write((c > 96 && c < 123)? (c-32):c);
It produces the outagain.txt file:
SO SHE WENT INTO THE GARDEN TO CUT A CABBAGE-LEAF, TO
MAKE AN APPLE-PIE; AND AT THE SAME TIME A GREAT
SHE-BEAR, COMING UP THE STREET, POPS ITS HEAD INTO THE
SHOP. 'WHAT! NO SOAP?' SO HE DIED, AND SHE VERY
IMPRUDENTLY MARRIED THE BARBER; AND THERE WERE
PRESENT THE PICNINNIES, AND THE JOBLILLIES, AND THE
GARYALIES, AND THE GRAND PANJANDRUM HIMSELF, WITH THE
LITTLE ROUND BUTTON AT TOP, AND THEY ALL FELL TO PLAYING
THE GAME OF CATCH AS CATCH CAN, TILL THE GUN POWDER RAN
OUT AT THE HEELS OF THEIR BOOTS.
SAMUEL FOOTE 1720-1777
What am I missing?
DaveB
On Oct 17, 6:59 pm, "Firmansyah ." <[email protected]> wrote:
> can anyone explain more briefly the homework in lab 1022 which said that "Use
> either ChangeToUpperCaseInputStream class or
> ChangeToUpperCaseOutputStream class to convert the characters read to
> upper case"?
>
> is it using character stream to make so correctly read char, and then the
> return of method read() converted to char.
> after this we call Character.toUpperCase(ch) method?
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---