Hey there!! Please write a code alternative to the code in the description↓↓ P.S. You can modify my code! Conditions below↓ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Hey there!! Please write a code alternative to the code in the description↓↓ P.S. You can modify my code! Conditions below↓

~your code should be simpler and take less lines than mine ~it should have the same purpose! #Array is Palindrome or not# https://code.sololearn.com/cF4KOryUe1ji/?ref=app

27th Aug 2020, 2:10 AM
I M J
I M J - avatar
5 Answers
+ 2
Hello, The number of lines is very rarely a good measure of code quality. Technically you can write a java program in a single line but it would ruin the readability. You should rather think about different levels of abstraction. For example, an array of characters is conceptually the same as a String, and there are builtin methods to deal with strings easily. https://code.sololearn.com/cW5p6KV5W6NW/?ref=app
27th Aug 2020, 4:47 AM
Tibor Santa
Tibor Santa - avatar
+ 2
Yes, you should use the Scanner class for input. You can use various methods like nextInt or nextLine to fetch as many values as needed, but if you have to enter more values on SoloLearn you usually need to put them in multiple lines in the same input box that pops up. There is no interactivity here.
27th Aug 2020, 7:50 AM
Tibor Santa
Tibor Santa - avatar
+ 2
Tibor Santa yep! Thanx
27th Aug 2020, 7:51 AM
I M J
I M J - avatar
+ 1
user friendly is input just one word as string
27th Aug 2020, 4:47 AM
zemiak
0
Tibor Santa can you please tell me a better and faster way to input in Java in SoloLearn?? Since I have been used to to the user-friendly interface BlueJ till now...that's what was being taught in my school!! And apart from it now I'm trying to this new interface, SoloLearn!! Want to know to input almost everything, arrays, string, as far as you can say!! Most probably without scanner class / with scanner class , as your choice !(I only know about input through Scanner class😅)!
27th Aug 2020, 7:45 AM
I M J
I M J - avatar