- 流程图
- 代码思路流程图
- 代码设计流程图
- 注意的问题
- Scanner next()与nextline()的区别 :
一句话 nextline()可以输入空格、tab等特殊的字符,而且还可以避免在连续输入多个字符串的时候出现输入问题
- 父类与子类在这里尽量不要重名
- 代码
package MyDictionary;
public class Word {
String eWord;
String cWord;
public String geteWord() {
return eWord;
}
public void seteWord(String eWord) {
this.eWord = eWord;
}
public String getcWord() {
return cWord;
}
public void setcWord(String cWord) {
this.cWord = cWord;
}
public Word(String eWord, String cWord) {
this.eWord = eWord;
this.cWord = cWord;
}
public Word() {
this.eWord = null;
this.cWord = null;
}
public String toString() {
return (this.eWord + "===" + this.cWord);
}
}
package MyDictionary;
public class dictionaryFuction {
Word[] words;
int count;
public dictionaryFuction() {
words = new Word[100];
count = 0;
}
public boolean add(Word word) {
if (count < 100) {
this.words[this.count++] = word;
return true;
} else
return false;
}
public Word searchWord(String word) {
for (int i = 0; i < count; i++) {
if (this.words[i].