PRO192_-_PE_-_SU_2024_-_s_8_2153.webp
Winry97

PRO192_-_PE_-_SU_2024_-_s_8_2153.webp

  • Media owner Winry97
  • Ngày thêm
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()
2. Test f2()
2. Test f2()
Enter TC (1 or 2): 1
Enter TC (1 or 2): 2
Enter a string:
Enter a string:
Zoom
+ 100%
Close
Chưa có bình luận nào.

Thông tin

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

Image metadata

Filename
PRO192_-_PE_-_SU_2024_-_s_8_2153.webp
File size
182.5 KB
Dimensions
1920px x 991px

Share this media

Back
Bên trên Bottom