主要内容
string类
构造string对象
string s = new String("we are students");
string t = new String("we are students");]
用户无法输出String对象的引用
可以用已创建的String对象创建另一个String对象
String常量的引用
字符串的并置
常用方法
public int length()获取String对象的字符序列长度
public boolean equals(String s)比较对象的字符序列是否相同
public int compareTo(String s)字符序列比较大小
诸多类
Scanner类,StringTokenizer类,StringBuffer类,Date类,Calendar类,Math类,BigInteger类,Random类····
数字格式化
format方法,格式化整数,格式化浮点数
泛型
泛型类声明
class People<E>;
使用泛型类声明对象
Cone<Circle> coneOne;
coneOne = new Cone<Circle>(new Circle());
链表
链表可以感觉和C语言的链表有一些相似的地方
创建链表
LinkedList<String> mylist = new Linked List<String>();
常用方法
排序:public static sort(List<E> list) 按照升序排列
折半法:int binarySeach(List<T>list,T key,CompareTo<T> c) 查找有没有和key相等的元素
洗牌与旋转
public static void shuffle(List<E> list) 按洗牌算法重新随机排列
static void romate(List<E> list,int distance) 旋转表中的数据
public static void reverse(List<E> list) 翻转表中的数据
代码托管
码云链接:https://gitee.com/sq943997011/BESTI.IS.Java2018
脚本运行截图: