0
Строка наоборот
У меня получается строка наоборот, не могу понять в чем моя ошибка, помогите пожалуйста https://code.sololearn.com/cBDxFZ2RMO84/?ref=app
2 Antworten
0
// read the comments for corrections need
import java.util.Scanner;
public class Program
{
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String text = scanner.nextLine();
char[] arr = str.toCharArray(); // str is undefined, must be text.toCharArray()
String result = "hello there";
for (int i = array.lenght - 1; i>= 0; i--) { // spelling mistake in lenght (=> length) and array is undefined, may ypu mean arr.length
result = result + array[i]; // arr[i]
}
return result; // this is not needed, main is void.
// Are you trying to print then use System.out.print(result);
}
}
0
Thanks you wery mach!!!!!!!!!!!!!!!!!!