"switch"를 언급하는 소스의 모든 .java 파일 목록입니다 (대부분은 switch 문을 사용하는 것처럼 보이지만 일부는 주석으로 만 논의하는 것처럼 보입니다).
http://pastebin.com/grBqEjBE
그러나
은 원래의 질문에 대답 : 많은 예 가운데, 여기
JLabel.java
에서 하나 : 실제로 자바 API에
available입니다
public String getAtIndex(int part, int index) {
if (index < 0 || index >= getCharCount()) {
return null;
}
switch (part) {
case AccessibleText.CHARACTER:
try {
return getText(index, 1);
} catch (BadLocationException e) {
return null;
}
case AccessibleText.WORD:
try {
String s = getText(0, getCharCount());
BreakIterator words = BreakIterator.getWordInstance(getLocale());
words.setText(s);
int end = words.following(index);
return s.substring(words.previous(), end);
} catch (BadLocationException e) {
return null;
}
case AccessibleText.SENTENCE:
try {
String s = getText(0, getCharCount());
BreakIterator sentence =
BreakIterator.getSentenceInstance(getLocale());
sentence.setText(s);
int end = sentence.following(index);
return s.substring(sentence.previous(), end);
} catch (BadLocationException e) {
return null;
}
default:
return null;
}
}
합니다.
그래서 src.zip 및 grep을 추출하십시오. –
Java API에서 switch 문의 * 사용법 *을 찾고 계십니까? 도서관 자료실에서 그걸 뜯어 먹으면 도움이되지 않나요? 또한, 왜? –