201671010140.2016-2017-2 Java Program Java Study third week

Source: Internet
Author: User

Third week of Java learning

unconsciously, Learning Java is the third week, different from the beginning of the flawless, panic, in contact for a period of time, gradually familiar with some, understand its convenience, but also experienced some of its difficulties, this week the fourth chapter, "Objects and classes", in fact, in the second week of the experiment, I've been in touch with it, and I didn't understand why the scanner method uses the import statement, and now, by studying the fourth chapter, I know that the input from the console needs to be constructed with a scanner object, and with the "standard input stream" The System.in Association, which uses the import statement to introduce the scanner class in the Java.util package.

The Java program structure is constructed by the class as a module, and the C language is constructed by a function. A class is a template that describes an object, each consisting of a set of structured data (called an instance field) and a set of operations (called methods) on it. Mastering the package that the API is in, making it easy to import the required classes is a prerequisite for our construction program to master.

This week's learning Focus: how the user-defined class is defined, how the program is constructed, and the object's declaration is mastered. In this stage of learning, static methods, non-static methods (examples) of the distinction, use has caused me a certain degree of confusion and small trouble, in the fourth chapter of the classroom practice, there is a question "a class of non-static methods can access static member variables?" "I am aiming at this question, from here to the entrance, to help myself to better understand, to distinguish between the two differences and contact:" 1. Static member variables and static member methods belong to a class and not to a specific instance, and static members (including properties and methods) are initialized at the class loading stage, so when an instance (non-static method) accesses a static member, the static member must already exist, so it can be accessed. 2. Conversely, if you let a static method access the instance member, that is not the case, because the initialization of the instance member is after the static member. 3. A static domain in a class can be accessed either by an object name or by a class name. "Solved the problem.

Last week's experimental exercise is just a small test sledgehammer, this week's program has made me feel small difficulty, although clear algorithm, but always to C language inertia to consider, to write programs, sometimes a little messy, which caused my program has a lot of grammatical errors, although looking at the data can be corrected, but this is not a good compilation habit, Still need to be more careful.

201671010140.2016-2017-2 Java Program Java Study third week

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.