Add how many elements: 0
Enter TC(1-fl;2-f2;3-f3): 3
The list before running f3:
(A12,19) (B1X,56) (C34,8) (D2Y,47) (E67,56) (F,65)
(G1,8) (H,65)
OUTPUT:
(A12,19) (C34,8) (E67,56) (G1,8)
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 odd numbers in the string str (number separated by non-numeric characters).
f2: Reverse the first word in str string that contains the most digits (word = a string without space(s)).
The program output might look something like:
1. Test f1()
1. Test f1()
Zoom
+ 100%
Close