个人在复习Java时候看ssd3觉得比较重要的摘录,基本上考试喜欢考这些点。
-
importing a package does not slow compilation or execution, nor does it increase the size of the byte code.
-
it is not necessary to import java.lang
When programs produce screen output, it does not go directly to the screen. It goes to a holding area called a buffer. When the buffer is full, it is automatically flushed. Flushing empties the buffer and sends its contents to the screen -
System.in could be used for input directly. Its capabilities, however, are primitive as it can only read one character at a time. Reading a line of input this way would be cumbersome. Wrapping System.in in a BufferedReader object makes it possible to read entire lines of input. The BufferedReader method to read an entire line is readLine
-
Exception handling is a mechanism that allows failures to be handled outside the normal flow of the code.
-
When a method throws an exception, none of the remaining statements in that method are executed. If none of the methods in the call stack catch the exception and the top-most method is main, the program displays, in the standard error stream, a message that identifies the exception and terminates. To avoid premature termination of a program, you must include try-catch blocks that enable the program to recover from failures.
-
The stack trace shows the sequence of methods that were called before the exception was thrown.
-
Exception objects are instances of classes that descend from class Throwable. Throwable has two subclasses: Error and Exception.
-
Class Error is used for serious problems from which an application is unlikely to recover. An example is the “out of memory” error.
-
Class Exception is used for abnormal conditions that an application can be expected to `handled.
-
The Javadoc tag for an exception is the @throws tag—the @exception tag can also be used. The Javadoc comment for a method should have a @throws tag for each checked exception that the method might throw. It can also have @throws tags for unchecked exceptions but this is not necessary. The Javadoc comment should not have a @throws tag for exceptions that are caught and handled by the method.
-
Javadoc comments open with a “slash-asterisk-asterisk” sequence ( /** ) and close with an “asterisk-slash” sequence ( */ ) on the same line or on separate lines.
-
Common Javadoc Tags:
@author – programmer’s name; used for classes
@version – version of the program; used for classes
@param – description of a formal parameter; used for methods and constructors
@return – description of a return value; used for methods
@exception (or @throws) – description of an exception; used for methods and constructors
@see – reference to a related entity; used for classes, constructors, methods, and data fields -
A debugger is a convenient tool for locating the source of errors. A debugger allows you to execute one line at a time and observe the effect on the program’s variables.
-
An associatio