Java BASICS (18) IO streams (1), java basics io streams

Source: Internet
Author: User

Java BASICS (18) IO streams (1), java basics io streams

Here are some of the knowledge points and code I summarized in my previous class. Most of the notes I think are very good and classic, sincerely hope that these will help those who want to learn!

It is inconvenient to upload code by module. There are also many things, and they are also clear! If you need it, you can leave your email in the comments. I will certainly send it to you for free! Thank you for making progress on this platform !! Remember that programmers are selfless !!!

Also very welcome to my blog to watch blog address: http://www.cnblogs.com/duscl/

/* 1: exception (understanding) (1) exceptions of the program. (2) exception system Throwable | -- Error is a serious problem and we will not handle it. | -- Exception | -- RuntimeException Exception during runtime, we need to modify the code | -- Non-RuntimeException Exception during compilation, which must be handled; otherwise, the program compilation fails (3) Exception Handling:: by default, the JVM outputs The Exception name, cause, location, and other information on the console, but the program cannot be executed. B: handle it yourself. a: try... catch... finally Write and process the code by yourself, and the subsequent program can continue to execute B: throws will not be able to handle it, declare it on the method, and tell the caller that there is A problem (4) interview question: what is the difference between a compilation exception and a runtime exception? The compilation exception must be handled. Otherwise, the compilation does not pass the runtime exception. You can also handle the difference between B: throw and throws. throw: In the method body, the exception object name is followed, and only one throw throws is an exception object. It indicates that there must be an exception that produces throws: In method declaration, the following is the exception class name. It can be multiple throws. It is A possibility that there is an exception in the declaration method. This exception does not necessarily produce the (5) finally keyword and Its interview question: finally is used to release resources, and its code will always be executed. Special case: before running finally, the jvm Exits B: What is the difference between a: final, finally, and finalize? B: If return exists in catch, is it still executed in finally? If it is executed, before or after return, before. Actually in the middle. In this class, we will talk about C: the deformation of exception handling try... catch... finally try... catch... try... catch... catch... try... catch... catch... fianlly try... finally (6) custom exceptions inherit from Exception or RuntimeException. You only need to provide A construction without parameters and A construction with parameters. (7) Note that the following is an Exception: the parent method has an exception thrown. The child rewrite method must be less than or equal to the parent when throwing an exception. B: the parent method has no exception thrown, the child rewrite method cannot have an exception. C: the parent method throws multiple exceptions. The child rewrite method must be less or less than the parent method. 2: File (master) (1) most IO stream operations are File operations, so Java provides the File class for us to operate the file (2) constructor A: File = new File ("e: \ demo \ a.txt "); B: File file = new File (" e: \ demo "," a.txt "); C: file file = new File ("e: \ demo"); File file2 = new File (file, "a.txt"); (3) Functions of the File class (complete by yourself) a: Creation function B: deletion function C: Rename function D: Judgment function E: retrieval function F: advanced retrieval function G: Filter Function (4) case:: output the name of the file with the specified suffix name in the specified directory. a: first obtain all the file names, and then judge the file during traversal. Then, output B: first judge, then obtain the file, and then traverse the output directly to B: modify file names in batches *\

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.