For input by the console, you need to use the scanner control to assist, you can use it for an entire row or a single byte of reading, in addition to note that if it is a password input problem, need to take advantage of the console space, its limit can only be fixed to read a whole line at a time.
When Java needs to include some packages, use the import reserved word, unlike the include
Java details on formatted output issues in white paper P57
The use of the String.Format method is similar to print, but differs in that it simply creates a formatted string, while the latter prints out a formatted string.
Multiple print forms for the current time are detailed with the white Paper P59. Use the date () method.
Furthermore, the concept of parameter index values has been found in 5 parts, and the parameter index value starts at 1, because 0 has identifiers that are used as other meanings to prevent confusion, and the parameter index value ends in $
About file write issues, detailed with white paper P60, using the PrintWriter control, when working with files, because you might encounter a situation where the file cannot be found, you need to add throws to the main method after the Filefoundexception Statement tells the compiler that I already know that a file might not be found, and that it contains a package: java.io.*, a read operation on a file needs to take advantage of the scanner control, The Paths.get method enables the file name to be converted to a file pathname, allowing the scanner control to open files instead of creating a string. Note: You will need to use the. Close method to close the file after using open file, otherwise you will not see the write effect.
The current IDE's working directory can be obtained using the System.getproperty ("User.dir") code.
Although Goto has been set as a reserved word in Java, it is actually used in the form of break+ tags or continue+ tags.
The For loop body in Java has a variant form that facilitates the manipulation of each element in an array, which cannot involve subscripts, detailing with white papers P79
The same variable is declared in two blocks in Java that cannot be set in a holster, unlike C + +.
For the comparison of floating-point numbers, it is important to pay attention to the use of floating-point numbers in the loop to compare events that produce an exit loop, which can produce a dead loop.
For switch statements, white Paper authors do not recommend it, but there are some details about the use of p73
Tagged break and tagged continue, respectively, is to jump out of the target loop body and jump into the target loop body, in essence, is to jump out of the target block and jump into the target block, so you can implement multiple nested loops of the jump, the label needs to be set in the loop body (block) before adding:.
For large values, Java provides two classes, BigInteger large integers and bigdecimal large floating-point types, and large numeric operations cannot use operators such as +,-, but instead use the methods provided by the class, because Java does not allow overloaded operators, unlike C + +. Detailed and white paper P77
In Java, there is essentially no multidimensional array but an array of 1-dimensional arrays, and the declaration of an array can take advantage of the variable: int[] a = new int[x];
When you create a numeric array, a Boolean array, an array of objects, all the elements are initialized to 0,false,null;
The array length can be obtained using Array.Length.
For array printing, you can use the Arrays.tostring method, which converts a numeric value into a character formatted output.
In Java, you can use ' = ' to make a shallow copy of the array, the effect of this method is two array shared memory, the deep copy method is the use of arrays.copyof (array, length), for the length parameter can be changed to the size of the target array, the corresponding copy of the resulting value will be truncated or 0, For an array of out-of-bounds access, Java will error.
There is no pointer operation in Java, the elements in the array cannot be obtained by a[] b=a+1, and the Java array is more similar to the C + + comparison with the latter int *name = new int [] instead of int name[100], the essential difference is that one placed in the heap is placed on the stack , and in the comparison of multidimensional arrays, the former can generate an irregular array, equivalent to the latter's int * * * name = new int[10][]; ++++++ for () name[i]=new Int[i]; This makes the array specifications more flexible and detailed with the white paper P88
The command-line array in Java does not store the program name, unlike the. BinarySearch method, which can find the target value in the array.
The arrays type in Java also provides the. Sort method for sorting, which is an optimized fast-row, and the Math.random method produces 0 to 1 and does not contain 1 random numbers.
This article is from the "Developing_rookie" blog, make sure to keep this source http://8942041.blog.51cto.com/8932041/1627170