请看下面的程序即可:
public class MapTest {
public static void main(String[] args){
Map map = new HashMap(); //定义Map集合对象
System.out.println("Map集合的isEmpty方法返回值是:"+map.isEmpty());
map.put("apple","新鲜的苹果");
System.out.println("Map集合的isEmpty方法返回值是:"+map.isEmpty());
}
}
结果:
Map集合的isEmpty方法返回值是:true
Map集合的isEmpty方法返回值是:false