application对象的常用方法public void setAttribute(String key, Object obj)的意义?
举一反三
- 中国大学MOOC: 以下Pair泛型类public class Pair<K, V> { public Pair(K key, V value) { this.key = key; this.value = value; } public K getKey(); { return key; } public V getValue(); { return value; } public void setKey(K key) { this.key = key; } public void setValue(V value) { this.value = value; } private K key; private V value;}经过类型擦除后,变成以下类public class Pair { public Pair(Object key, Object value) { this.key = key; this.value = value; } public Object getKey() { return key; } public Object getValue() { return value; } public void setKey(Object key) { this.key = key; } public void setValue(Object value) { this.value = value; } private Object key; private Object value;}
- 下列程序运行结果是 public class Demo { public static void main(String[] args) { Object obj=new Father(){ public void show(){ System.out.println("helloworld"); } }; obj.show(); } } class Father{ public void show(){ System.out.println("hello father"); } }
- 下面哪个方法不是Object类中定义的方法?( ) A: public boolean equals(Object obj) B: public int compareTo() C: public String toString() D: public int hashCode()
- main方法是Java<br/>Application程序执行的入口点,下列main方法原型不正确的是()。 A: public<br/>static void main(String[]args) B: public<br/>static void main(String args[]) C: public<br/>static void main(String[]a) D: public<br/>static void main(string[]args)
- main方法是Java Application程序执行的入口点,下面main方法的方法头哪项是合法的: A: public static void main( ) B: public static int main (String[] arg) C: public static void main (String args[ ]) D: public void main (String args[])