Is there any problem with the following class? Is the passing of an argument to the private methods appropriate? Are the data members appropriate? Explain.
/*
Problem Question4
*/
class MyText {
private String word;
private String temp;
private int idx;
public String firstLetter( ) {
idx = 0;
return getLetter(word);
}
public String lastLetter( ) {
idx = word.length() - 1;
return getLetter(word);
}
private String getLetter(String str) {
temp = str.substring(idx, idx+1);
return temp;
}
}
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.