Map集合的遍历之键值对对象找键和值源码分析
package com.itheima.map;
public class Demo04_MapEntry {
/**
* @param args
* 解释一个Map.Entry
*/
public static void main(String[] args) {
//Entry其实是Map.Entry的一个子类对象
//(a):Map.Entry<String, Integer> en = it.next();//父类引用指向子类对象
//(b):Entry<String, Integer> en = it.next(); //直接获取的是子类对象
//对于a,是编译看左边(父类),运行在右边(子类),父类都是接口,子类都是有具体的实现内容
}
}
interface Inter {
interface Inter2 {
public void show();
}
}
class Demo implements Inter.Inter2 {
@Override
public void show() {
}
}