Home > Back-end >  Written application runs in eclipse, Enter 159523. Press the Enter key does not display the running
Written application runs in eclipse, Enter 159523. Press the Enter key does not display the running

Time:10-30

The code is as follows:
Package Decisions;
import java.util.Scanner;
Public class CharactersTranverse {
//159523
/* *
* @ param args
*/
Public static void main (String [] args) {
//TODO Auto - generated method stub
System. The out. Println (" both Please enter a integer between 1000 and 999999: ");
Scanner in=new Scanner(System.in);
String num=in the next ();
in.close();
The String result="";
While (num. Length () & gt; 3) {
Result=num. Substring (0, num. Length () - (4);
}
Result=num + result;
System. The out. Println (" The result is "+ result);

}

}
Results:
Written application runs in eclipse, Enter 159523. Press the Enter key does not display the running results

CodePudding user response:

Death in while the debug cycle the brothers, you, always can be found in the loop, because your num is not changed, so has been the length=7

CodePudding user response:

You than while into the if judgment, the result is assigned a in the loop
  • Related