PRO192_-_PE_-_SU_2024_-_s_1_2167.webp
Thúy Nga1

PRO192_-_PE_-_SU_2024_-_s_1_2167.webp

Add how many elements: 0
Enter TC(1-fl;2-f2;3-f3): 3
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
Chưa có bình luận nào.

Thông tin

Category
PRO192
Thêm bởi
Thúy Nga1
Ngày thêm
Lượt xem
4,289
Lượt bình luận
0
Rating
0.00 star(s) 0 đánh giá

Image metadata

Filename
PRO192_-_PE_-_SU_2024_-_s_1_2167.webp
File size
156.3 KB
Dimensions
916px x 988px

Share this media

Back
Bên trên Bottom