arrays | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

arrays

for Quiz we need to solve a problem, there is a java program we need to invert the words as a strings converted to a char array , Java Arrays 26 Code Project Reverse a String, My program actually does that but system does not qualify as resolved public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter any String: "); String text = sc.nextLine(); char[] arr = text.toCharArray(); //your code goes here char reverseArray[] = new char [arr.length]; for (int i = arr.length-1, j= 0; i>=0; i-- , j++) { reverseArray[j]= arr[i]; } System.out.println(arr); System.out.println(reverseArray); } Either if I removed the output arr and just leave the sysout for reverseArray still is not getting resolved, I do not know what else to do.

27th May 2022, 10:56 PM
Miguel Angel Pegueros
Miguel Angel Pegueros - avatar
1 Answer
+ 1
A pgrs Do not print anything else except final output. Simple thing of every task: If I say I understand only "xyz" then why I will accept "abc" too. So you just need to print "xyz"
28th May 2022, 2:24 AM
A͢J
A͢J - avatar