String类的常用方法
public String(char[] value)
public String(char[] value, int offset, int count)
public char charAt(int index)
public char[] toCharArray()
public String(byte[] bytes)
public String(byte[] bytes, int offset, int length)
public byte[] getBytes()
public byte[] getBytes(String charsetName)throws UnsupportedEncodingEception
public boolean equals(String anObject)
public boolean equalsIgnoreCase(String anotherString)
public int compareTo(String anotherString)
public boolean contains(String s)
public int indexOf(String str)
public int indexOf(String str, int fromIndex)
public int lastIndexOf(String str)
public int lastIndexOf(String str, int fromIndex)
public boolean startsWith(String prefix)
public boolean startsWith(String prefix, intoffset)
public boolean endsWith(String suffix)
public String replaceAll(String regex, String replacement)
public String replaceFirst(String regex, String replacement)
public String substring(int beginIndex)
public String substring(int beginIndex, int endIndex)
public String[] split(String regex)
public String[] split(String regex, int limit)
public String concat(Stirng str)
public String toLowerCase()
public String toUpperCase()
public String trim()
public int length()
public String intern()
public boolean isEmpty()
数据表一对多关系转为类间关系
一个部门Dept有多个雇员Emps
要根据部门取出雇员信息
class Dept {
private Emp[] emps ;
public void setEmp() {
this.emps = emps;
}
public Emp[] getEmps() {
return this.emps;
}
}
class Emp {
}
public class Test {
System.out.println(dept.getInfo());
for(int x=0; x < dept.getEmps().length; x++) {
System.out.println(dept.getEmps()[x].getInfo());
}
}