The error message suggests that the variable Collections is not recognized by the Java compiler. This variable is usually part of the java.util package, which contains utility classes for handling collections.

To fix this error, you need to make sure that the java.util package is imported at the top of your Java file, like this:

import java.util.Collections;

public class KafkaConsumerExample {
    // rest of the code
}

If you have already imported the java.util package, make sure that you have spelled it correctly and that there are no typos in the import statement

In java code as followconsumersubscribeCollectionssingletonListtopicName; while true ConsumerRecordsString String records = consumerpoll100; for ConsumerRecordString Stri

原文地址: https://www.cveoy.top/t/topic/dpe5 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录