改过程序后:
import javax.swing.JOptionPane;
class Cvs{ public static void main(String args[]){ String output ="" ; int i , j , k ; String input = JOptionPane.showInputDialog("Please Enter String") ; if (input.length() <= 60){ for ( i = input.length() -1 ; i >= 0 ; i--) output+= input.charAt( i ); }
JOptionPane.showMessageDialog( null , output, "Reverse Program", JOptionPane.PLAIN_MESSAGE); System.exit(0); } }