20165336 2016-2017-2 "Java Programming" third week study summary

Source: Internet
Author: User
Tags case statement instance method modifier git clone

20165336 2016-2017-2 "Java program design" The third week study summary textbook study summary
    1. The class name uses the Latin alphabet so the first letter of the name uses uppercase letters. The first letter of each word should be capitalized.
    2. Member variables are valid throughout the class, and their validity is independent of the order in which he writes in the class body.
    3. Local variables are only valid within a method and are related to their declared location.
    4. The member variable has a default value of 0, and the local variable has no default value.
    5. The name of the constructor must be exactly the same as the name of the class in which he resides, and there is no type. Allows you to write several construction methods in a class, but you must ensure that their parameters are different.
    6. Method overloading means that multiple methods in a class can have the same name, but the parameters of these methods must be different. The parameters of the two methods are only one of the following, one is the number of arguments, the other is the same number of arguments, but the parameter list corresponds to a parameter of the type of the different.
    7. The return type of the method and the name of the parameter do not participate in the comparison, that is, if the names of the two methods are the same, the parameters must be guaranteed to be different, even if the return type is different.
    8. Avoid any ambiguity in overloading
    9. Run the main class with the package name note the directory to run
    10. All are non-package names and classes in the same folder can be used with each other, and no package name class can use the import statement to use the class with the package name, but the class with the package name cannot use the class without the package name anyway.
    11. Variable parameters: You can use "..." instead of several parameters, such as "public void f (int ... x)".
Problems in teaching materials learning and the solving process
    • Issue 1: Differences in member variables, local variables, instance variables, class variables, instance methods, class methods
    • Problem 1 Solution: Through the book Online Search summary is as follows.

member variables :
Variables defined within the class body are called member variables ;
If the variable has a static keyword modifier, it is called a static variable or a class variable ;
If the variable does not have a static keyword modifier, it is called a non-static variable or an instance variable ;

Local Variables :
variables, parameters, and variables defined in the code block are called Local variables in the method.

An instance method is a method that must be created after an instance of a class to call methods that belong to a particular instance of the instance name. Method Name ();

A class method is a static method of a class that belongs to a class. Can be called in a class byte; The method name is the name of the class. ();
class methods are primarily used for tool class methods.

    • Question 2:java "Understanding in the same package"
    • Problem 2 Solution: Java in the same package, refers to exactly the same, not the parent package subordinate to the same package in the relationship decoration is also the meaning
Problems in code debugging and the resolution process
    • Issue 1: In the Java Runtime extension, the Jerry.jar file needs to be stored in the Jre/lib/ext folder in the JDK installation directory, but I do not see the Ext folder under the folder.
    • Issue 1 solution (not resolved): Jdk\jre\lib\ext is the extended class library that the JVM loads. After a network lookup did not find the answer to the real problem, I think it should be a version of the cause of the folder changes, ready to start from some. jar folder to find which is the Extension class folder.
    • Issue 2: From Windows with Notepad and git bash upload to the code cloud, using the Git clone in Ubuntu to the virtual machine during the compilation of the text is garbled compilation is not recognized.
    • Problem 2 solution (not resolved): After looking for data and debugging, found in the virtual machine will be set to UTF-8 or GBK can only solve the problem of the runtime Chinese characters but other Chinese path, the language file will appear garbled, there is no viable way to find.
Last week's summary of the wrong quiz
    • Key points of the wrong question:
    1. The switch statement takes note that the default statement is executed only if the case statement is completely non-compliant, and if the condition in the scenario statement does not follow the contents of the default statement, but satisfies the case statement if no break or continue is encountered, Other statements after the case will continue to be executed.
Code Hosting

(run result of statistics.sh script)

20165336 2016-2017-2 "Java Programming" third week 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.