JAVA學習博客---2015-7

@Updata 2015.7.17  開始熟悉APIWPS首字母自動大寫,有的沒有加#編號的,其實方法首字母不是大寫例如Char charAt 其實是char charAt.固然駱駝寫法charAt,A是大寫的。更新Java.lang.string 1.0。java

@Updata 2015.7.20添加Java.lang.StringBuilder 5.0java.until.Scanner 5.0. 數組

@Updata 2015.7.21 增長了一些方法。app

@Updata 2015.7.23 感冒休息,這個月先這樣吧。ide

 

   java.lang.string 1.0ui

# char charAt (int index)this

Index 指標,指針,索引。spa

這個 char charAt 是返回給定位置的代碼單元。指針

 

# int codePointAt(int index) 5.0code

5.0意思是這個是java SE 5.0出來的新方法,之後不另外解釋了。orm

返回從給定位置開始或結束的代碼點。固然是int

 

# int offsetByCodePoints(int startIndex, int cpCount) 5.0

返回從startIndex代碼點開始,位移cpCount後的代碼點索引。即從哪開始,而後日後動多少代碼點。

 

# int compareTo(String other)

Compare 比較對照,相比。

按照字典順序,若是字符串位於other以前,返回一個負數,若是字符串位於other以後,返回一個正數,若是兩個字符串相等,返回0.

 

# boolean endsWith(String suffix)

若是字符串以suffix結尾,返回true

 

# boolean equals(Object other)

若是字符串與other相等,返回true

 

# boolean equalsIgnoreCase(String other)

若是字符串與other相等(忽略大小寫),返回true.

 

# int indexOf(String str)

# int indexOf(String str, int fromIndex)

# int indexOf(int cp)

# int indexOf(int cp, int fromIndex)

返回與字符串str 或代碼點cp 匹配的第一個子串的開始位置。這個位置從索引0fromIndex開始計算。若是在原始串中不存在str, 返回-1.

 

# int lastIndexOf(String str)

# int lastIndexOf(String str, int fromIndex)

# int lastindexOf(int cp)

# int lastindexOf(int cp, int formIndex)

返回與字符串str或代碼點cp匹配的最後一個子串的開始位置。這個位置從原始串尾端或fromIndex開始計算。

 

# int length()

返回字符串的長度。

 

# int codePointCount(int startIndex, int endIndex) 5.0

返回startIndexendIndex-1之間的代碼點數量。 沒有匹配成對的代用字符將計入代碼點。

 

# String replace(CharSequence oldString, CharSequence newString)

Sequence,序列,按順序排好

返回一個新字符串。這個字符串用newString代替原始字符串中全部的oldString.能夠用StringStringBuilder對象做爲Charsequence參數。

 

# boolean startsWith(String prefix)

Prefix ,前綴,將某事物加在前面。

若是字符串以prefix字符串開始,返回true

 

# String substring(int beginIndex)

# String substring(int beginIndex, int endIndex)

返回一個新字符串。這個字符串包含原始字符中從beginIndex到串尾或endIndex-1的全部代碼單元。

 

# String toLowerCase()

返回一個新的字符串。這個字符串將原始字符串中的全部大寫字母改爲了小寫字母。

 

# String toUpperCase()

返回一個新的字符串。這個字符串將原始字符串中的全部的小寫字母改爲了大寫字母。

 

# String trim() 

Trim,修剪整理。

返回一個新的字符串。這個字符串將刪除了原始字符串頭部和尾部的空格。

 

 

 

  java.lang.StringBuilder 5.0

# StringBuilder()

構造一個空的字符串構建器。

 

# int length()

返回構建器或緩衝器中代碼單元數量。

 

# StringBuilder append(String str)

Append 附加,貼上。

追加一個字符串並返回this

 

# StringBuilder append(char c)

追加一個代碼單元並返回this

 

# StringBuilder appendCodePoint(int cp)

追加一個代碼點,並將其轉化爲一個或兩個代碼單元並返回this

 

# void setCharAt(int i, char c)

將第i個代碼單元設置爲c

 

# StringBuilder insert(int offset, String str)

Insert,插入。

offset位置插入一個字符串並返回this

 

# StringBuilder insert(int offset, Char c)

offset位置插入一個代碼單元並返回this

 

# StringBuilder delete(int startIndex, int endIndex)

刪除偏移量從startIndexendIndex-1的代碼單元並返回this

 

# String toString()

返回一個與構建器或緩衝器內容相同的字符串。

 

 

   java.until.Scanner 5.0

# Scanner(InputStream in)

用給定的輸入流建立一個Scanner對象。

 

#String nextLine()

讀取輸入的下一行內容。

 

#String next()

讀取輸入的下一個單詞(以空格做爲分隔符)。

 

# int nextInt()

# double nextDouble()

讀取並轉化下一個表示整數或浮點數的字符序列。

 

# boolean hasNext()

檢測輸入中是否還有其餘單詞。

 

# boolean hasNextInt()

# boolean hasNextdouble()

檢測是否還有表示整數或浮點數的下一個字符序列。

 

 

  java.lang.System 1.0

# static Console console() 6

Console,控制檯,操縱檯。

若是有可能進行交互操做,就經過控制檯窗口爲交互的用戶返回一個Console對象,不然返回null。 對於任何一個經過控制檯窗口啓動的程序, 均可以使用Console對象。不然,其可用性將與所使用的系統有關。

 

  Java.io.Console 6

# static char[] readPassword(String prompt, Object...args)

# static String readLine(String prompt, Object...args)

顯示字符串prompt而且讀取用戶輸入,直到輸入行結束。Args參數能夠用來提供輸入格式。

 

  Java.until.Scanner 5.0

# Scanner(File f)

構造一個從給定文件讀取數據的Scanner.

# Scanner(String data)

構造一個從給定字符串讀取數據的Scanner

 

 java.io.PrintWriter 1.1

# PrintWriter(String fileName)

構造一個將數據寫入文件的PrintWriter。文件名由參數指定。

 

 java.nio.file.Path 7

# static Path get(String pathname)

根據給定的路徑名構造一個path.

 

  java.math.BigIneteger 1.1

# BigInteger add(BigInteger other)

# BigInteger subtract(BigInteger other)

# BigInteger multiply(BigInteger other)

# BigInteger divide(BigInteger other)

# BigInteger mod(BigInteger other)

返回這個大整數和另外一個大整數other的和,差,積,商以及餘數。

# int compareTo(BigInteger other)

若是這個大整數與另外一個大整數other相等,返回0;若是這個大整數小於另外一個大整數other,返回負數;不然返回正數。

# static BigInteger valueOf(long X)

返回值等於X的大整數。

 

  java.math.BigInteger 1.1

# BigDecimal add(BigDecimal other)

# BigDecimal subtract(BigDecimal other)

# BigDecimal multiply(BigDecimal other)

# BigDecimal divide(BigDecimal other RoundingMode mode) 5.0

返回這個大實數與另外一個大實數other的和,差,積,商。要想計算商,必須給出舍入方式rounding mode. RoundingMode.Help_up是常規的四捨五入的舍入方式。

# int compareTo(BigDecimal other)

若是這麼大實數與另外一個大實數相等,返回0. 若是這個大實數小於另外一個大實數,返回負數,不然返回正數。

# static BigDecimal valueOf(long x)

# staitc BigDecimal valueOf(long x, int scale)

返回值爲xx/10^scale的一個大實數。

 

 

 Java.util.Arrays 1.2

# static String toString(type[] a) 5.0

返回包含a中數據元素的字符串,這些數據元素被放在括號內,而且逗號分離。  參數a  類型爲 int,long,short,char,byte,boolean,floatdouble的數組。

# static type copyOf(type[] a, int length) 6

# static type copyOfRange(type[] a, int start, int end) 6

返回與a類型相同的一個數組, 其長度爲length或者end-start,數組元素爲a的值。  參數 a  類型爲

相關文章
相關標籤/搜索