<分区>
我想创建一个方法,可以切割单词变量并将每个字母放入数组tab[]
。
这是我的努力。
public class Mot {
private String mot;
private String tab[];
//getter et setter
public String getMot() {
return mot;
}
public void setMot(String mot) {
this.mot = mot;
}
//constructeur plein
public Mot(String mot, String[] tab) {
this.mot = mot;
this.tab = tab;
}
//constructeur vide
public Mot(){
}
//methodes
public void affichage(){
System.out.println(this.tab[1]);
}
//placage de chaque lettre dans un tableau
public void tableau(){
this.tab = this.mot.split(mot);
}
}