八個基本概念:html
全部的Java方法都生命在類裏,調用非靜態的方法是基於該方法所在類的實例化的對象;
java
靜態方法的調用不基於對象,程序伴隨着static main方法運行;編程
Java有八種基本類型,五種整型,兩種浮點型以及布爾型;api
Java操做和控制結構與C或JavaScript很是類似;數組
Math類提供了常見的數學函數;oracle
String 對象是一串字符序列,或者更精確地說, 是UTF-16編碼的值;編程語言
A String
represents a string in the UTF-16 format in which supplementary characters are represented by surrogate pairs (see the section Unicode Character Representations in the Character
class for more information). Index values refer to char
code units, so a supplementary character uses two positions in a String
.函數
能夠用System.out對象在終端輸出,Scanner能夠從System.in裏讀取終端輸入;編碼
數組和集合能夠用在相同類型的元素之間;spa
System.out 中的out是一個PrintStream對象
public final static PrintStream out = null;
方法中定義的變量在使用前須要初始化,類中的非final變量會被設置爲初始值。
public class Test { final static int num0; //Error:(7, 21) java: variable num0 not initialized in the default constructor static int num1; int num2; private void test() { System.out.println(num2); // 0 } public static void main(String[] args) { System.out.println(num1); int num3; System.out.println(num3);//Error:(17, 28) java: variable num3 might not have been initialized Test t = new Test(); t.test(); // 0 } }
關於Java等編程語言選擇UTF-16編碼,知乎上有段野史:
www.zhihu.com/question/35214880
Java 1.8多了個排序方法
* @param a the array to be sorted * * @since 1.8 */ public static void parallelSort(byte[] a){/** **/}