Write a program in Java to accept any string and display thei respective ASCII? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Write a program in Java to accept any string and display thei respective ASCII?

Input: JAVA output: 74 65 86 65 Could you convert the alphabets to the opposite case from lower to upper vice versa. https://code.sololearn.com/c5K2mvz3HnP3/?ref=app

27th Jan 2019, 1:14 AM
Prantik Sarkar
Prantik Sarkar - avatar
5 Answers
+ 3
Diego yes it is done, but not like mine, and there was no challenge rather I shared simpler approach. Try it. Thank you for finding the same, take a close look in class name, file name and you will observe the readability, comment lines helps with future edification. Enjoy de/coding.
17th Mar 2019, 7:18 PM
Prantik Sarkar
Prantik Sarkar - avatar
+ 2
To my fellow SoloLearn users, the program, written in Java to get ASCII of a String. Well yes there are challenges like mine, but which method is more primitive, less dependent on pre defined library functions, more clean and in my 12 years of experience in learning and teaching, how to make stupid machine, like a 16 bit microprocessor, or a 4 bit microcontroller work in least time. Now, if I were to find the why we need Java(2002), I was in 11th standard in high school, with a windows 98 operating, the CPU(ALU/CU/Register/Cache/accumulator) 500mhz single core, 128MB SRAM, 40 GB HDD. Notepad to write the code,command prompt to link source javac, no IED's. Today, it is more wiser to use advaced hardware and faster bit rate in our palm. Hence this program is pretty old boring, the advanced version already ASCII converter is done, but why and how, I like universal code of 1's and 0's, Java will add that byte code and create a Virtual machine, platform independent. Think, imagine, express..Thank you
17th Mar 2019, 6:34 PM
Prantik Sarkar
Prantik Sarkar - avatar
+ 2
James please try the code. No need to use case sensitive string library classes. If you fing any error, please point out, so that I could rectify any bug/error. Thank you
17th Mar 2019, 7:10 PM
Prantik Sarkar
Prantik Sarkar - avatar
+ 1
There's already a challenge like yours: https://www.sololearn.com/learn/6105/
27th Jan 2019, 1:40 AM
Diego
Diego - avatar
+ 1
String.toUpperCase() or String.toLowerCase() should work. var a = "AbcDefGHi"; var b = a.toUpperCase(); // b equals "ABCDEFGHI" However, ASCII is case-sensitive. Each capital letter has a different code to the lower case letter.
27th Jan 2019, 2:02 AM
James
James - avatar