20145301 Five weeks Study summary

Source: Internet
Author: User

20145301 five weeks Summary of learning contents of Learning Summary Eighth Chapter 8.1 Syntax and inheritance architecture
    • What is an exception? In the Java programming language, the exception class defines a slight error condition that may be encountered in the program. You can write code to handle the exception and continue the program execution, rather than interrupting the program.

    • Java provides an exception-handling model that allows you to check for exceptions and handle them accordingly. It implements the catch-and-throw model of exception handling. With this model, you only need to be aware of the exceptions that are necessary to be handled. This exception-handling model, provided by Java, replaces the means by which the return value or parameter mechanism returns an exception code from a method.

    • In Java, all exceptions have a common ancestor throwable (can be thrown). Throwable specifies the commonality of any problem that can be transmitted through a Java application using the exception propagation mechanism in the code. Throwable: There are two important subclasses: Exception (Exception) and error (Errors), both of which are important subclasses of Java exception handling, each of which contains a large number of subclasses.

    • Error (Error): A bug that the program cannot handle, indicating a more serious problem in running the application. Most errors are unrelated to what the code writer does, and represent a problem with the JVM when the code runs.

    • Exception (Exception): Is the program itself can handle the exception, the disease can be cured Exception. For example, when I try to divide by 0, I will quote exception

8.2 Inheritance Syntax details Nineth 9.1 Using the Collection collection object
    1. Definition form: interface InterfaceName {...}

      The member method defaults to abstract, public, and the member property defaults to static, final decorated

      The interface simply provides a form, and the specific implementation details are given to its class to complete

      Because the interface does not involve a specific implementation, the member variable in the interface is a static constant variable, which defaults to static and final decoration

    2. class implements an interface: Class MyClass implements A, B, C {...}

      A class can implement multiple interfaces

      Note: Although there is no explicit declaration method in the interface is public, but the default access control in the interface is public, and the default access control in the class is in-package friendly, the method must be decorated in class with the

    3. Selection of interfaces and abstract classes:

      Multiple inheritance is not supported between classes in Java, but classes can implement multiple interfaces

      If the class needs to include implementations of some methods, it must be implemented as an abstract class, and in other cases, the use of interfaces is preferred, making the program easier to extend

Map with 9.2 key values
    • Use interface to define the appearance of an abstract behavior, which is declared as public abstract, and is not required and cannot be manipulated. For convenience, the public abstract can also be omitted, and the compiler will assist in completing the process. You can use an interface enumeration constant, which can only be defined as public static final. For convenience, you can also omit public static final.
    • Interfaces can inherit other interfaces, or they can inherit more than two interfaces at the same time, and also use the extends keyword.
    • The enum syntax can be used to define enumeration constants, which actually define the class, and the constants enumerated in the enum are actually public static final, and cannot be written to instantiate the enumeration type directly because the constructor permission is set to private and only in the class can be instantiated.
Problem and resolution process issues

No clear overrides and overloads.

Resolution process Other
    • The difference between an abstract class and an interface:
      In design philosophy, a class can inherit only one abstract class, but it can implement multiple interfaces.
      Abstract classes can contain normal member variables and non-abstract methods, and the member variables and methods of the interface have a fixed decoration. That is, public static final and public abstract. For inheritors, the method subclasses of the abstract class may not all be replicated, but the method abstract class of the interface must be completely replicated.
      Abstract classes can also be implements interfaces, can implement methods in the interface, or can not be implemented. Abstract classes can not be final decorated. Abstract classes can contain non-abstract methods. Experience

      This week, the feeling of learning more difficult, abstract things more and more, the difficulty of understanding gradually increased. Such as: object, encapsulation and other concepts, even if read, can not fully understand. Also can not eat C language strongholds, need I put more time and energy, I need more to expand to learn, not only limited in reading, code code, do not understand the place, I will first yards code, good first retained the problem, to communicate with classmates. I found that the study of blog Park should not only be confined to the small circle of dky, we can take some time to see other masters of the blog to learn, will be very helpful to our study.

Learning progress Bar
Target number of lines of code Blog Volume Study Time Important Growth
Goal 4000 rows 30 Articles 400 hours ----
First week 100/4000 2/30 15/400 Hello Java
Second week 350/4000 3/30 40/400 Process Control
Third week 500/4000 4/30 50/400 Classes and objects, encapsulation
Week Four 700/4000 5/30 50/400 Inheritance, interfaces
Resources
      • "Java Learning Notes"
      • Learning Guide for Java Learning notes
      • Bi Xiangdong Java Teaching

20145301 Five weeks Study summary

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.