第3章対象向け基礎知識
5660 ワード
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()
データテーブルの1対の多関係からクラス間関係への変換
1部門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());
}
}