八个基本概念: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){/** **/}