For this program, at the beginning of the time, did not knock on the 22,29,33 line of the print statement, when debugging does not automatically open the console, so has been suspected that the code may be wrong. So you can open it manually, but if you knock on the code, the system will automatically bounce off the console.
1 /**2 * Find out the maximum value3 */4 ImportJava.io.BufferedReader;//Import all classes in the IO package for input and output in the Java system5 Importjava.io.IOException;6 ImportJava.io.InputStreamReader;7 8 Public classCHAP01 {9 Public intFindmax (int[] a) {//A method definition that finds the maximum value from the shaping array aTen intX=A[0];//assigns the value of the first element in array a a[0] to x as the initial One for(intI= 1;i<a.length; i++) {//finding a in the array by loop order is the maximum value of the element A if(a[i]>x) { -x=A[i]; - } the } - returnX//returns the maximum value of the element saved in X - } - Public Static voidMain (string[] args)throwsIOException {//defines the main method, which throws an exception when the keyboard data is read incorrectly + - int[] A=New int[5];//declaring and creating an integer group of num length 5 +CHAP01 array =NewCHAP01 ();//declaring and creating an Chap01 object array ASystem.out.println ("Please enter data:"); at for(intI =0;i<a.length;i++) {//enter data from the keyboard to array a, with each integer ending with a enter key -BufferedReader keyb=NewBufferedReader (NewInputStreamReader (system.in)); -String line = Keyb.readline ();//reads a line of string from the keyboard as an integer -A[i]=integer.parseint (line);//get an integer from the line string and assign it to the A[i] element - } - intmax = Array.findmax (a);//use Max to save the largest value in an array inSystem.out.println ("The number you entered is:"); - for(inti=0;i<a.length;i++) {//output The value of each element in array a sequentially toSystem.out.print (a[i]+ "\ T"); + } -System.out.println ("\ n" + "Maximum value:" +max);//The value of the output max after execution, which is the maximum value in array a the } *}
There was no error, and the result was
Program Console does not open automatically for Eclipse debugging