Couple of Days back i started reading Beginning Java 2, JDK 5 Edition By Ivor Horton.
Nice book written by Ivor Horton.
Below are few quotations i found from this book from the next 3 chapters ( 7-8-9).
1) The exceptions that are defined by the Error class and its subclasses are characterized by the fact that they all represent conditions that you aren’t expected to do anything about, so you aren’t expected to catch
them. Error has three direct subclasses—ThreadDeath, LinkageError, and VirtualMachineError.
2) Exceptions identify errors that arise in your program.
3) Exceptions are objects of subclasses of the Throwable class.
4) Java includes a set of standard exceptions that may be thrown automatically, as a result of errors in your code, or may be thrown by methods in the standard classes in Java.
5) If a method throws exceptions that aren’t caught, and aren’t represented by subclasses of the Error class or by subclasses of the RuntimeException class, then you must identify the exception classes in a throws clause in the method definition.
6) If you want to handle an exception in a method, you must place the code that may generate the exception in a try block. A method may have several try blocks.
7) Exception handling code is placed in a catch block that immediately follows the try block that contains the code that can throw the exception. A try block can have multiple catch blocks that each deals with a different type of exception.
8) A finally block is used to contain code that must be executed after the execution of a try block, regardless of how the try block execution ends. A finally block will always be executed before execution of the method ends.
9) You can throw an exception by using a throw statement. You can throw an exception anywhere in a method. You can also rethrow an existing exception in a catch block to pass it to the calling method.
10) You can define your own exception classes that, in general, should be derived from the class Exception.
11) Stream readers and writers are objects that can read and write byte streams as character streams.
12) So a character stream is essentially a byte stream fronted by a reader or a writer.
13)A stream is an abstract representation of a source of serial input or a destination for serial output.
14) The classes supporting stream operations are contained in the package java.io.
15) Two kinds of stream operations are supported: binary stream operations will result in streams that contain bytes, and character stream operations are for streams that contain characters in the local machine character encoding.
16) No conversion occurs when characters are written to, or read from, a byte stream. Characters are converted from Unicode to the local machine representation of characters when a character stream is written.
17) Byte streams are represented by subclasses of the classes InputStream and OutputStream.
18) Character stream operations are provided by subclasses of the Reader and Writer classes.
19) The printf() method that is defined in the PrintStream and PrintWriter classes formats an arbitrary number of argument values according to a format string that you supply. You can use this method for the System.out object to produce formatted output to the command line.
20) The static format() method that is defined in the String class will format an arbitrary number of argument values according to a format string that you supply and return the result as a String object. This method works in essentially the same way as the printf() method in the PrintStream class.
21) An object of the Formatter class that is defined in the java.util package can format data into a StringBuilder or StringBuffer object, as well as other destinations.
22) An object of the class File can encapsulate a file or directory path. The path encapsulated by a File object does not necessarily correspond to a physical file or directory.
23) You can use a File object to test whether the path it encapsulates refers to a physical file or directory. If it does not, there are methods available to create it together with any directories that
are part of the path that may also be required.
24) The File class defines static methods for creating temporary files.
25) An object of type FileDescriptor can also identify a physical file.
26) A FileOutputStream object can be created from a File object, and the file will be opened for writing. If the file does not exist, it will be created where possible.
About the Author
Ivor Horton started out as a mathematician, but shortly after graduating, he was lured into messing about with computers by a well-known manufacturer. He has spent many happy years programming occasionally useful applications in a variety of languages as well as teaching mainly scientists and engineers to do likewise. He has extensive experience in applying computers to problems in engineering design and to manufacturing operations in a wide range of industries. He is the author of a number of tutorial books on programming in C, C++, and Java. When not writing programming books or providing advice to others, he leads a life of leisure.
Friday, 3 October 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment