Respuesta :
public class JavaApplication95 {
public static void reverser(String txt){
String newTxt = "";
for (int i = txt.length()-1; i >= 0; i--){
newTxt += txt.charAt(i);
}
System.out.println(newTxt);
}
public static void main(String[] args) {
reverser("monitor");
}
}
I hope this helps!
The program is an illustration of loops.
Loops are used to perform repetitive operations
The void method in Java, where comments are used to explain each line is as follows:
//This defines the method
public static void reverser(String str){
//The declares and initializes newStr
String newStr = "";
//This iterates through string str, backwards
for (int i = str.length()-1; i >= 0; i--){
//This populates newStr with the reversed str
newStr += str.charAt(i);
}
//This prints newStr
System.out.print(newStr);
}
At the end of the method, the reversed string is printed.
Read more about similar programs at:
https://brainly.com/question/18405844