20165330 2017-2018-2 "Java Programming" 3rd Week study Summary

Source: Internet
Author: User
Tags instance method

Textbook Knowledge Summary Fourth Chapter class and Object
    • Classes: including class declarations and class bodies
    1. Basic format:
     class 类名 {         类体的内容     }
    1. class declaration: Class+ class Name (note: The first letter of the class name should be capitalized)
    2. Class Body: A pair of "{" and "}" after a class declaration and their contents, including the definition of a variable's declaration and method
    3. Method: Including method header and method body
 方法头 {     方法体的内容 }
    • Construction method and object creation
    1. Create object: The moniker name of the class
    2. Object access variables: objects. Variables
    3. An object invokes a method in a class: an object. method
    • Class variable: A declared variable that is given a modification with static
    • Instance variable: Declared variable that is not decorated with static
    • Instance method: Method type with no static decoration
    • Class method: Method type with static modification
    • this keyword
    1. In the instance method
      • Pair variable: this. Member variable
      • When a static member variable appears in an instance method: Class name. Member Variable
    2. Invoke instance method: this. method
    3. Call class Method: Class name. method
    • Package
    1. Format: Package Name
    2. Compile: Javac main class name. java
    3. Run: Java package name. Main class Name
    • Import statement
      • Introduce all the classes in a package: import java.util.*;
    • Access rights
      • Private variables: Member variables that are decorated with private
      • Common variables: Member variables modified with public
Study problem record this week
    • The directory was not found when compiling the program during JDB debugging

      WORKAROUND: Compile-time file is a. class suffix file, to jump to his directory folder bin, and bin with the file name is a space, no/

    • After commissioning and then run

      Workaround: Do not add-classpath before Jdb debugging, the class name should not be followed by the. java. Attach Classpath's explanation

    • When you run a program with a package name on the book

      WORKAROUND: There are two different programs in this package, compile Stu.java first, compile Example4_15.java, and then run Example4_15

    • Occurs when running a triangle class with a package

      Program for

      Workaround: Create the appropriate folder for the name after the package, move the program into the folder, and run the compilation

    • When compiling a program, you can use thejavac-g-D. /.. /bin class name. Java"enables class files to be automatically stored in the bin directory, and then run with"JAVA-CP. /.. /bin class name "
    • Shift operator:>>, << for signed shift,>>> for unsigned shift
    • & Operations: Two x 1 o'clock is 1, otherwise 0
    • | operation: Two x 0 o'clock is 0, otherwise 1
    • ^ Operation: 0 at the same time. Otherwise 1
    • The content in parentheses after the IF statement can only be true or false

Code Hosting

This week's summary
    • In this week's study, I found that the amount of code has increased, the amount of knowledge on the textbook has increased a lot, but also need to understand the operation of some basic commands to learn from the heart, not only in the notebook, the teacher also added some new knowledge content, the class really must be well consolidated. In addition to knock the code process to be more careful, some symbols often leak compilation error, to have patience!

20165330 2017-2018-2 "Java Programming" 3rd 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.