API
应用程序编程接口
Scanner类
一个可以解析基本类型和字符串的简单文本扫描器
java.util.Scanner;
System.in:从键盘录入数据
匿名对象
没有变量名的对象:创建对象时只有创建对象的语句,却没有把对象地址值赋值给某个变量。
Random类
用于生成为随机数
java.util.Random
ArrayList类
java.util.ArrayList ;
是大小可变的数组的实现,存储在内的数据称为元素
- 常用的方法:
public boolean add(E e)
public E remove(int index)
public E get(int index)
public int size()
存储基本的数据类型:

String类
java.lang.String;
字符串不变:字符串的值在创建后不能被改变
public String();
public String(char[] value)
public String(byte[] bytes)
public boolean equals (Object anObject)
public boolean equalsIgnoreCase(String anotherString)
public int length()
public String concat()
public char charAt(int index)
public int indexOf(String str)
public String substring (int beginIndex)
public String substring (int beginIndex, int endIndex)
public String split(String regex)
public char[] toCharArray()
public byte[] getBytes()
public String replace(CharSequence target, CharSequence repacement)
static 关键字
类变量
静态方法
- 静态方法可以直接访问类变量和静态方法
- 静态方法不能直接访问普通成员变量或成员方法,反之则可以
- 静态方法中,不能使用this关键字
内存中现有静态内容后又非静态内容
静态代码块:
定义在成员位置,使用static修饰的代码块{}
随着类的加载而执行且执行一次,优先于main方法和构造方法的执行
Arrays类
java.util.Arrays
操作数组的方法
public static String toString(int[] a)
public static void sort(int[] a)
Math类
java.lang.Math
包含用于执行基本数学运算的方法
public static double abs(double a)
public static double ceil(double a)
public static double floor(double a)
public static long (double a)

被折叠的 条评论
为什么被折叠?



