2
Add how many elements: 0
Enter TC(1-fl;2-f2;3-f3): 3
The list before running f3:
(H,19) (G,56) (E,8) (F,47) (E,56) (C,65) (B,8) (A,65)
OUTPUT:
(H,19) (G,56) (E,8) (F,47) (E,56) (C,65) (A,65)
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: Sum of odd numbers in the string str (number separated by non-numeric characters).
f2: Reverse the first longest word in str (word = a string without space(s)).
The program output might look something like:
<
1. Test f1()
1. Test f1()
Zoom
>
90%
Close