201621123069 Java Programming 3rd week of study summary

Source: Internet
Author: User
Tags set time

1. Summary of this week's study

Learning to object-oriented, will learn a lot of fragmented concepts and knowledge. Try to use mind mapping to organize these fragmented concepts and knowledge points. Use the tool to draw a link between the knowledge points and the knowledge points you learned this week. The steps are as follows:
1.1 Write the key points you think are important in this week's study, such as 类、对象、封装

I think this week's more important points of knowledge include import keywords, classes, objects, encapsulation, constructors, and so on.

1.2 Organize these keywords with mind mapping or OneNote or other tools.

2. Written assignment 1. Transformation of data structure operation ' rational number ' (emphasis) in object-oriented mode

Note: attributes must be decorated as为private

1.1 Your main code (need to show your school number and name in the program) and paste the program's git address.

1.2 Compare your code with the code of the course, what is the difference between object-oriented programming and process-oriented programming?

Object-oriented programming can be better used for objects, more convenient, but not enough encapsulation

2. Constructors and initialization blocks

2.1 What is the use of the constructor with PTA 5 (constructor and ToString)? What are the features of its function format?

Constructors are used to initialize the properties of an object, which are divided into both parameter and parameterless, and we can use the property method of its corresponding class after initializing the object and creating the object.

2.2 If a class does not write a constructor, does it have a constructor function? If a class has only a constructor with parameters, does it have a default constructor with no arguments?

There is a constructor, which defaults to generating a function with no parameters.

2.3 Look at String the source code of the class, find out the 3 constructors of the string class that can be understood, and use your own words to describe the differences between the 3 constructors.

String (); The function is to construct an empty string object;

String(char[] value);Constructing a String object using a char array

To initialize.

2.4 Combining the PTA (constructors and initialization blocks) illustrates the similarities and differences between the initialization block and the constructor. and explain, initialize block with constructor who executes first? What is the difference between an initialization block and a static initialization block, and who executes it first?

Initialization is simply an initialization value, and the constructor is assigned a value. Static initialization blocks are executed only once and static initialization blocks are performed first than static initialization blocks.

3. Code Analysis: Math class

3.1 java.lang.Math When you use the method of a class, why don't you need a new Math object and then call the appropriate method on that object?

The properties and methods used in math are static classes and cannot be called externally.

3.2 What error will be generated if new Math ()? Try reading the math class source code to analyze the reason.

It can be seen that math belongs to the final class, and a compilation error is generated with new.

3.3 Further: What do you think the object needs to be new to use, and what method to invoke without having to create the corresponding object to use? (Key Check)

When a method is declared with static, it is used with new, and the static method is called without having to create the corresponding object.

4. Heavy-duty overload

4.1 What is an overload? What is a constructor overload? How can I distinguish two overloaded methods?

Overloading means that the method has the same name, but the parameters can be different. 2 or more than 2 methods in a class can have the same name, as long as their parameter declarations are different. The distinguishing method is to differentiate by type.

4.2 java.lang.Math Examples of 1 method overloads in a class cited?

5. Code read: Final

The final modified variable cannot be changed, but why does the following code work?
final int[] NUMBS= {1,2,3,4,5}; NUMBS[2] = 1;

The final modified variable does not change, but the content can be changed

6. Time-Date classes in JAVA8: Writing functions public static boolean isMondayToFriday()

Function: Judging today if it is Monday to Friday, return True, return false. The function is called in the main function, and if true, the "Weekday + Name Study number" is output, otherwise the output "Rest + Name Study number".
: Key code.
Tip: Use LocalDateTime, DayOfWeek class
Resources:

JAVA 8: Robust, easy-to-use time-date api-importnew.pdf
Java8datetimetest.java

7. Encapsulation

7.1 In combination with PTA (SHAPE), please summarize in your own words what is meant by object-oriented 封装 ? What are the benefits? **

Encapsulation is the external inability to manipulate data, improve security

7.2 What are the keywords related to encapsulation?

Private is both internal

Public publicly the data that you are willing to give people to see

protected protection of

Default defaults for

8. Pairing programming Practice (unfinished, 0 points)

Find a similar level of students to complete 1-2 questions. Before you start programming, you can discuss the content first.
Write the experience report, including the following: 1. Name of the other party. 2. The completed topic. 3. Impressions. 4. Photos (last time many students did not post photos, please affix)

1. Lu Weibin 2. We have completed the public static Boolean Ismondaytofriday (). Sentiment is in the joint thinking when we have a healthy competition, all have to think about and share the idea of the same, not only completed the exercise also promoted the friendship.

3. Code cloud and PTA3.1. Codes Cloud Code submission record
    • In the Code cloud Project, select statistics-commits history-set time period, and then search for and
      • The first two commits when the hand is written in the second week ...

3.2 PTA Problem set complete situation diagram

Two graphs are required (1. Ranking chart. 2.PTA Submission list diagram)

3.3 Count the amount of code completed this week

The weekly code statistics need to be fused into a single table, using the parameters of the latest version of the Code statistics tool, which can be found in the -history Project Wiki address for detailed usage. The table looks like this:

201621123069 Java Programming 3rd week of 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.