Question

java program You must use a for loop in your solution. To convert from a char...

java program

You must use a for loop in your solution.

  • To convert from a char to an int:

(int)'a'; //this will return the int 97

  • To convert from an int to a char:

(char)97; //this will return the char a

0 0
Add a comment Improve this question Transcribed image text
Answer #1
public class ASCIIValues {

    public static void main(String[] args) {
        for (int i = 97; i <= 122; i++) {
            System.out.println(i + " " + (char) i);
        }
        System.out.println();
        for (char i = 'A'; i <= 'Z'; i++) {
            System.out.println(i + " " + (int) i);
        }
    }
}

Add a comment
Know the answer?
Add Answer to:
java program You must use a for loop in your solution. To convert from a char...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT