Hi Ashok A V: Ok. Thank U. The homework says must use "FilterInputStream." This is only a byte stream? I look here: http://java.sun.com/j2se/1.4.2/docs/api/java/io/FilterInputStream.html I am thinking different? Zhao
--- On Thu, 9/10/09, Ashok A V <[email protected]> wrote: From: Ashok A V <[email protected]> Subject: [java programming] Re: Lab-1022 To: [email protected] Cc: [email protected] Date: Thursday, September 10, 2009, 5:06 PM Hi, This is a code snippet that can provide you a clue for converting character to uppercase. import java.io.*; import java.util.Scanner; public class ReadCharacter { public static void main(String[] args) { try { System.out.print("Enter the Character: "); Scanner scanner = new Scanner(System.in); char character = scanner.next().charAt(0); System.out.println("Thanks for the Character, " + Character.toUpperCase(character)); } catch (Exception ioe) { System.out.println("IO error trying to read character!"); System.exit(1); } } } The problem is that you are using a byte stream to read the input , rather if you are looking for character stream you can also have a look at the Character streams Read this : http://java.sun.com/docs/books/tutorial/essential/io/charstreams.html and try using character stream rather than byte streams friend .. :) Thanks, Ashok A V On Wed, Sep 9, 2009 at 9:37 PM, Zhao Lin <[email protected]> wrote: Hi. I try again, int b = in.read(); if (b != -1) { char c = (char)b; System.out.print(c); } This code write out to console. I add two line to make upper case in this but error message say 'Accessing method toUpperCase'. int b = in.read(); if (b != -1) { char c = (char)b; Character letter1 = new Character (c); Character letter2 = letter1.toUpperCase(c); System.out.print(c); } FilterInputStream have no method to read characters but only byte. I thinking to use subclass BufferedInputStream and convert to string? I wait for you. Please help me. I stuck on this for week now. Look over internet. Still confuse. Thank you for your consideration. Zhao -- Victory belongs to the most persevering. - Napoleon --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
