201521123032 Java Programming 2nd week of study summary

Source: Internet
Author: User
Tags set time

1. Summary of this week's study

This week Java reviewed various data types, and using floating-point types in Java would be imprecise, instead of double rows. Learn the type of string, the object of string is immutable, can not be modified after creation, in the concatenation of string directly use "+"; enumeration type is equivalent to the previous switch. The reference to a one-dimensional array refers to the two-dimensional array, and how the Arrays tool class operates.

2. Written work
  1. Use eclipse to correlate the JDK source code () and view the source of the string object? Simple analysis of the design ideas of string objects.
  2. Why should we try to modify the string as frequently as possible by using StringBuilder instead of string?
    1. Because the object of string is immutable, it is necessary for the weak to frequently modify the string to create a large number of string objects.
    2. StringBuilder can be used for a large number of stitching strings, which is much more efficient than modifying a string and then deleting the old string.
  3. Compare the values of two strings for equality? Why can't I use = = to compare directly?
    1. Detects whether the contents of a string are equal, should be compared using equals, and is not case sensitive.
    2. Compare directly with = = Whether the comparison is the same object, the comparison is just the value of the reference.
  4. Try using the concept of a string pool to interpret the output of the following program segment and answer this code to create several string objects:

    String str1 =“hi“, str2=“hi“;String str3 = new String(str1)System.out.println(str1==str2);   程序的输出结果为ture,这段代码创建了两个字符串对象,一是str1和str2的字符串池,二是str3的字符串池。
  5. The Integer i = 100;//100 is the base type, I is the reference type, why can I be assigned to the 100?
    1. int is the basic data type, and integer is the reference data type. The integer in the title automatically removes the box and then reads the address of the Int.
    2. Reference: http://bbs.csdn.net/topics/390082317
  6. Tries to parse the following code output

     integer i1 = 127;integer i2 = 127;i1 = = i2; //true of false? Integer i1 = 128;integer i2 = 128;i1 = = I2; true of false result, Ture,false.  
  7. Package writes Stringutil class with Javac, Java,-classpath,-D
    in   com.ibm packages, with one method

     public static void foo1 () {System.out.println ( Stringutil. class+ "method:foo1");          

    Write the main class in the edu.jmu package with the Com.ibm.StringUtil Foo1 method
    7.1 Trying to compile and run with the command line ,
    7.2 puts the generated stringutil.class into the d:\lib correct directory structure, main.class in d:\test the correct directory structure, tries to run under the command line, and.
    7.3 Where the source code is placed in Eclipse and which directory the class file is placed in. Click Ctrl+f11 in the Eclipse project to run main directly and try to analyze the rationale behind the implementation.

  8. Own goals and plans in this course
    • Please describe your technical basis (what language, how many lines of code written)
      • Some C language, still not enough to grasp
    • How much time are you going to spend in this class in a week? How many lines of code are you going to write a week? What type of learning is used? How do you plan to solve the difficulties?
      • Prepare 7-8 hours a week.
      • The code can write how much to write, try my best.
      • Encounter difficulties first Baidu, do not understand will ask the roommate.
    • Smart target Reference link for this course
  9. Choose: How much money should you have in a bus card? Please analyze the reason

3. Using the code cloud to manage Java code
    • In the Code cloud Project, select statistics-commits history-set time period, and then search for and

201521123032 Java Programming 2nd week of study summary

Related Article

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.