Java Array&String&IO&ENUM

Java Array&String&IO&ENUM

  1. Array

  2. String

  3. IO

  4. ENMU

  5. Reference

Array

  1. Array

  2. ArrayList

    1. add

    2. clear

    3. contains

    4. get

    5. indexOf

    6. remove

    7. size

    8. trimToSize

Sting

  1. String

    1. Comparting

    2. equals & ==

    3. startsWith & endsWith

    4. indexOf & lastIndexOf

    5. substring

    6. concat

    7. valueOf

  2. StringBuild

    1. length

    2. capacity

    3. setLength

    4. ensureCapacity

    5. append

    6. charAt

    7. setCharAt

    8. getCharts

    9. reverse

    10. append

    11. insert

    12. dletet&deleteCharAt

IO

  1. Baisc - Byte&Character Input Output

    1. Byte streams should only be used for the most primitive I/O

    2. Character streams are often "wrappers" for byte streams. The character stream uses the byte stream to perform the physical I/O, while the character stream handles translation between characters and bytes. FileReader, for example, uses FileInputStream, while FileWriter uses FileOutputStream.

    3. in CopyCharacters, the int variable holds a character value in its last 16 bits; in CopyBytes, the int variable holds a byte value in its last 8 bits.

    4. Most of the examples we've seen so far use unbuffered I/O. This means each read or write request is handled directly by the underlying OS. This can make a program much less efficient, since each such request often triggers disk access, network activity, or some other operation that is relatively expensive.

  2. be used for the most primitive I/O

  3. Input

  4. Output

  5. File&Path

ENUM

  1. Enum + Instance field

public enum WhoisRIR {
    ARIN("whois.arin.net"),
    RIPE("whois.ripe.net"),
    APNIC("whois.apnic.net"),
    AFRINIC("whois.afrinic.net"),
    LACNIC("whois.lacnic.net"),
    JPNIC("whois.nic.ad.jp"),
    KRNIC("whois.nic.or.kr"),
    CNNIC("ipwhois.cnnic.cn"),gg
    UNKNOWN("");

    private String url;

    WhoisRIR(String url) {
        this.url = url;
    }

    public String url() {
        return url;
    }
}

Reference

  1. Java enum example

标签: none

添加新评论