String str=new String()String (char a[])String (char a[],int startIndex,int count)==进行比较)==只能用equals()进行比较public int length():获得String对象的字符序列长度。public boolean equals(String s) :比较字符序列是否相同。public boolean startsWith(String s):比较字符序列前缀是否为指定字符序列。public boolean endsWith(String s):比较字符序列后缀是否为指定字符序列。public int compareTo(String s):按字典序列与指定字符序列s比较大小。public boolean contains(String s):判断是否包含指定 字符序列public int indexOf(String s):返回s首次出现的位置public int lastIndexOf(String s):返回s最后出现的位置public int indexOf(String s,int startpoint):返回指定索引开始位置之后的,s首次出现的位置public String substring(int startpoint):返回复制指定位置到最后位置的字符序列所得到的新序列public String substring(int start,int end):返回复制指定开始位置到指定结束位置的字符序列所得到的新序列public static String valueOf(<基本数据类型> n)<基本数据类型> n=<相应类>.parse<相应数据类型>(s)public String toString():返回创建对象类名@对象的引用的字符串,可重写。public void getChars(int start,int end,char c[],int offset):从数组C的offset处存放String类字符序列sart到end-1处的字符。public char[] toCharArray():返回一个长度相等的数组。public byte[] getBytes():使用默认字符编码,存放String的字符序列到字节数组中,并返回引用。public byte[] getBytes(String charsetName):使用指定字符编码,存放String的字符序列到字节数组中,并返回引用。(可能返回UnsupportedEncodingException异常)String(byte[]):用指定字节数组构造一个String对象。String(byte[],int offset,int length):从字节数组offset位置取length个字节构造String对象。public String repalceAll(String regex,String replacement):用replacement字符序列替换regex匹配的序列。public String[] split(Sring regex):存放按照regex分割的单词在String数组中。(注意前缀是否匹配影响数组存放)
length():获取字符序列长度capacity():获得实体容量StringBuff append(String s):追加s到StringBuff中。StringBuff append(int n):n转化为String类,追加到StringBuff中。StringBuff append(Object o):追加o的字符序列表示到StringBuff中。public char charAt(int n):得到StringBuff位置n处的字符。public void setChar(int n,char ch):用ch替换StringBuff位置n处的字符。StringBuff insert(int index,String str):在index位置处插入str。public StringBuff reverse():翻转StringBuff字符序列。StringBuff replace(int startIndex,int endIndex,String str):用str替换startIndex到endIndex-1处的字符序列。
StringTokenizer(String s):默认分隔标记分析s。StringTokenizer(String s,String delim):指定分隔标记delim分析s。hasMoreTokens():查看计数变量是否大于一。nextTokens():逐个获取String对象单词。countTokens():获得计数变量的值。Scanner scanner=new Scanner(str)useDelimiter(正则表达式):利用正则表达式解析str。hasnext():判断最后一个单词是否被返回。next():依次返回单词。nextInt()或者nextDouble:依次返回单词并进行类型转换为int或者double型。
在假期实验楼学习和书本p186到188中都有,已经整理过不多加赘述。
public Random()public Random(seed)nextInt(int n):返回0-n之间的某个整数。nextDouble():返回0-1.0之间的随机数。nextDouble():返回0-1.0之间的随机数。nextBoolean():随机返回true或者false。
Console cons=System.comsole()char[] passwd=cons.readPasswoerd()
class 名称<泛型列表>声明对象:同样多加一个<泛型列表>
LinkedList<String>mylist=new LinkList<String>()public boolean add(E element):链表末尾添加数据为element的新结点。public boolean add(int index,E element):链表指定位置添加数据为element的新结点。public boolean clear():删除链表所有结点,使成为空链表。public boolean remove(E element):删除链表首次出现element的结点。public E remove(int index):删除指定位置结点。public int indexOf(E element):返回首次出现element的位置,没有返回-1。public int lastIndexOf(E element):返回最后出现element的位置,没有返回-1。public E set(int index,E element):替换index位置结点数据为element。public int size():返回链表长度,即结点个数。public boolean contains(Object element):判断是否有结点数据为element。public boolean addFirst(E element):链表头添加数据为element的新结点。public boolean addLast(E element):链表末尾添加数据为element的新结点。public E getFirst:得到第一个结点中的数据。public E getLast:得到最后结点中的数据。public E removeFirst(int index):删除第一个结点,并返回这个结点数据。public E removeLast(int index):删除最后一个结点,并返回这个结点数据。public Object clone():得到一个克隆列表。Iterator <String> iter=list.iterator()iter.hasNext()iter.next()public static sort(List<E>list):元素升序排列int binarySearch(List<T>list,T key,CompareTo<T> c):折半查找是否含有参数keypublic static void shuffle<List<E> list):洗牌static void rotate(List<E> list,int distance):旋转`public static void reserve<List<E> list):翻转
Stack<E>public E push(E item)public E pop()public boolean empty()public E peek()返回数据索引:public int search(Object data)
HashMap<String,Student> hashtable=HashSet<String,Student>()public void clear():清空public Object clone():返回当前散列映射的一个克隆public boolean containsKey(Object key):判断是否有键/值对使用了参数指定的键public boolean containsValue(Object value):判断是否有键/值对使用了参数指定的值public V get(Object key):返回用key做键的键/值对中的值public boolean isEmpty():判断是否不含任何键/值对public V remove(Object key):删除key做键的键/值对,返回对应的值public int size():返回散列映射大小,即键/值对数目
TreeSet<E>public boolean add(E o):添加结点,数据为参数opublic void clear():删除所有结点public void contains(Object o):判断是否包含指定参数的对象public E first():返回第一个结点中的数据public E last():返回最后一个结点中的数据public boolean isEmpty():判断是否空集public boolean remove(Object key):删除存储指定参数的最小结点TreeMap<K,V,>
解决过程:和结对学习的小组成员共同讨论,查找,发现问题后改正。





测试完成后补充
原文:https://www.cnblogs.com/atbaoi/p/8747572.html