20165206 2017-2018-2 "Java Programming" 6th Week study Summary

Source: Internet
Author: User
Tags shuffle

20165206 2017-2018-2 "Java Program Design" 6th Week Study summary Textbook study summary
    • String class: Can be used directly, there can be no child class.
    • String object: You can use the string class to declare an object and create an object, for example: string s = new String ("We are students");
      String t = new String ("We are students");
    • Strings are collocated: String objects can be collocated using "+" and a new string object is obtained from end to end.
    • Common methods of the string class:
    The
    1. public int Length () is used to get the length of the character sequence of a string object;
    2. public boolean equals (String s) is used to compare the character sequence of the current string object with the parameter s The character sequence of the specified String object is the same;
    3. public boolean startsWith (String s), public boolean endsWith (Sting s) Determines whether the character sequence prefix of the current string object is the character sequence of the string object s specified by the argument;
    4. public boolean contains (string s) Used to determine whether the character sequence of the current string object contains the character sequence of the parameter s;
    5. public int indexOf (string s) retrieves the first occurrence of the character sequence position of s and returns that position from the 0 index position of the character sequence of the current string object , if not retrieved, the return value of the method is-1;
    6. public int lastIndexOf (string s) retrieves the position of the last occurrence of the character sequence of s from the 0 index position of the character sequence of the current String object, and returns the position, if not retrieved , 1 is returned;
    7. public string trim () gets a new string object that is a sequence of characters after the character sequence of the current string object is stripped of the trailing space.
    • Regular expression: a regular expression is a sequence of characters of a string object that contains characters that have special meanings, which are called meta-characters of regular expressions.
    • Generics: Its primary purpose is to establish a collection framework with type safety.
    • List: A data structure consisting of several objects called nodes that are used to dynamically reduce or increase data items.
    • Sort: public static sort (List
    • Find: int BinarySearch (List
    • Shuffle: public static void Shuffle (List
    • Rotation: static void rotate (List
    • Press stack: Public e push (e item);
    • Stack: Public E pop ();
    • Determine if there is data in the stack: public E peek ();
    • Gets the data at the top of the stack, but does not delete the data: public int search (Object data);
Problems in code debugging and the resolution process

Issue 1: When compiling the code, I first compiled the code in the entire folder, but an error occurred, prompting me that the compilation was unsuccessful.

Problem 1 Solution: I then compile the code separately, without modification, but both compile and run successfully.

I do not know what the reason is after Internet access.

Code Hosting

Last week's summary of the wrong quiz

Error 1 and understanding: The child class declares a member variable whose name is the same as the member variable inherited from the parent class, but not the same type, and the subclass hides the inherited member variable.

Wrong question 2 and understanding: public void SomeMethod (int i) and public int somemethod () are method overloads.

Wrong question 3 and understanding: Polymorphism refers to a method of a parent class when a quilt class overrides, it can produce its own behavior and functionality.

Sentiment

There are more new concepts of learning contact this week, and some things are not very well understood, such as regular expressions. It also introduces some of the string classes that have been used in the past. Feel the harvest is not small, to continue to strengthen learning and practice, and strive to grasp the knowledge earlier.

20165206 2017-2018-2 "Java Programming" 6th 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.