Java study notes two --API class record

JavaSE class record (b)

the first lesson

  1. Overloaded methods: the same method name, a list of different parameters

  2. Rewrite method: method name, same parameter list

    1. Two same: the same method name, same parameter list

    2. Two small: small and equal access to the parent class, the type of the return value less than or equal parent (the return value of basic data types, must be equal, it must be less than or equal parent class reference data type)

    3. A large: greater than or equal to the thrown exception parent

  3. JDK package structure

    1. For ease of use and maintenance, the subcontracting, the JDK class library is divided in accordance with the packet structure, different functions divided in different packages. The package is often used as follows:

    2. package Features
      java.lang Base class java program, such as a string, multithreaded, java.lang class uses the higher frequencies, it can be used directly
      java.util Conventional tools, such as the collection, Random
      java.io File operations, input and output
      java.net Network-related operations
      java.math Math-related operations
      java.security Security-related actions
      java.Text Processing text, date, number, format and other operations.

       

  4. Documentation Comments

    1. With / ** start / end

    2. see See, author of, since began;

  5. Scanner class

    1. The step of using the reference package

      1. import package name. Class name
      2. For example:
      3.  import java.util.Scanner 
    2. Create Object

      1. Creating an object using the constructor method of the class
        1. format:
        2.  Data type variable name = new new data type (parameter list); // example Scanner SC = new new Scanner (the System.in); 
    3. Call the method

      1.  int I = scan.nextInt (); // . Variable Name Method Name 
    4. Receiving a string

      1.   
        scan.next();      
        scan.nextLine();
        

          

    5. the difference:

      1. The next method is effective to meet the first character (non-spacing, line breaks) to start scanning, when encountering the first space or end delimiter, end of the scan
      2. nextLine () method is to scan a single line.

Guess you like

Origin www.cnblogs.com/sunTyphonn/p/11767116.html