Question: Java The following class is given: import java.util.Arrays; public class StringImproved { / * * * Field Detail * The storage for the characters in
"Java
The following class is given:
import java.util.Arrays;
public class StringImproved
Field Detail
The storage for the characters in the StringImproved class
private char charArray;
Initialize storage string
public StringImprovedint size
ifsize
System.out.printlnSize should be a positive number"";
charArray new charsize;
public static void mainString args
TODO Autogenerated method stub
StringImproved stringImproved new StringImproved;
System.out.printlnstringImprovedappendabcde;
System.out.printlnstringImproved;
Write the following methods for the class:
lastIndexOf
public int lastIndexOfchar ch
Find the last instance of the character in the StringBuffer.
Difficulty
Parameters:
ch The character to search for.
Returns:
The index of the last instance of the nominated character, otherwise.
length
public int lengthReturns the length of the string. The length of the string is t XU he number of characters, digits, and punctuation, including space,
in the string. For example, Hello has a length of and Hello world."" is length
Difficulty:
Returns:
The length of the string. in the event of an error.
prepend
public boolean prependjavalang.String newString
Prepend the nominated string to the StringImproved object.
Difficulty if you are clever
Parameters:
newString The string to append.
Returns:
true if successful, false otherwise."
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
