So my teacher told me to make a string that makes whatever I type go in the opposite order (e.g. "hello there" becomes "ereht olleh"). So far I worked on the body and I came up with this
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
(The input needs to be in here)}}
public static String rev(String str) {
String reversed = "hello there";
for (int i = 0; i < str.length(); i++) {
reversed = str.charAt(i) + reversed;
}
return reversed;
My question now is that what I need to put under the public static void main(String[] args) to make it work. Yes I understand that this is homework, I tried looking through the book for help(no luck). I tried looking on the internet(no luck thanks to my little understanding to the more advanced method). I would appreciate any help and thank anyone in advance. I use netbeans if that would help any.