OUTPUT:
(E8) (G,56) (E,8) (F,47) (E,56) (C,65) (B,74) (A,83)
Question 4:
(2 marks) The interface IString below is already compiled and given in byte code format, thus you can use it without creating IString.java file.
public interface IString {
public int f1(String str);
public String f2(String str);
}
Write a class named MyString, which implements the interface IString. The class MyString implements methods f1 and f2 in IString as below:
f1: Count of words that the first and last characters are letters and the rest are numbers (word = a string without space(s)).
f2: Return the string by replacing odd-numbered characters that appear more than once in the string by the first letter in the string (keep the first odd-numbered character that satisfies the codition; Assume that there are at least 1 letter in the string).
The program output might look something like:
5 of 5
Paper No: 7
1. Test f1()
1. Test f1()
Zoom
FUO
85%
Close