Problem

Is there any problem with the following class? Is the passing of an argument to the priv...

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;

}

}

Step-by-Step Solution

Request Professional Solution

Request Solution!

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.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 4