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 the number of word is the longest palindrome string in the str string. (word = a string without space(s))
f2: Find first word is the shortest palindrome string in the str string. (word = a string without space(s).(A palindrome is a string that reads the same backwards as forwards)
Close
+ 100%
Zoom