hi,
wanna write a code that prints ascii characters from keyboard input,
plis help,:confused:
Printable View
hi,
wanna write a code that prints ascii characters from keyboard input,
plis help,:confused:
mosime, this is not a code bank. This is a forum, where we can discuss about anything related with Java. Just helping to there stuff, not doing homework here.
So you must put some effort first of all. If you stuck on something ask it clear, with what you have tried. Search on the web, you can find lots of similar examples.
As a wise person said:
Use an appropriate Subject. "Help, urgent!" isn't one.
SOS is not one either.
The code you have provided is going to nothing as is and I have a sneaking suspition that you don't have a clue what you're doing. I'm assuming you want a program that accepts a letter from the user and shows it's ASCII equivalent. If so...
Lesson: A Closer Look at the "Hello World!" Application (The Java™ Tutorials > Getting Started)
- First you need the basics of a standalone program (that contains a main method). To do that, read this:
- Next you need to understand how the declare variables:
Variables (The Java™ Tutorials > Learning the Java Language > Language Basics)
- Next, you need to get the user's input. Unless you have imported the appropiate class, the following code:
... is no good. The following might help:Code:System.out.println("Enter a character");
Char = UserInput.readChar();
Code:int userChar;
Scanner input = new Scanner(System.in);
System.out.println("Enter a character: ");
userChar = input.nextInt();
- Then you need to understand loops, the "for" statement:
The for Statement (The Java™ Tutorials > Learning the Java Language > Language Basics)
- Since this as to do with ASCII translations, here's a link to an ASCII table:
Table of ASCII Characters
Luck,
CJSL