首页 试题广场 > 试题详情
单选题

【C015382】Spring配置文件中有如下一段代码:
<bean id ="prototype" class="demo.MyBean" scope="prototype" />
<bean id ="default" class="demo.MyBean" />
则如下代码:
public static void main(String args[]){
ApplicationContext ac =
new ClassPathXmlApplicationContext("applicationContext.xml");
MyBean myBean1 = (MyBean) ac.getBean("prototype");
MyBean myBean2 = (MyBean) ac.getBean("prototype");
MyBean myBean3 = (MyBean) ac.getBean("default");
MyBean myBean4 = (MyBean) ac.getBean("default");

System.out.println(myBean1 == myBean2);
System.out.println(myBean3 == myBean4);
}
输出结果是( )

  • A.false
    false
  • B.false
    true
  • C.true
    true
  • D.true
    false
提交并查看答案
下一题 上一题
Ke星伙伴们的回答/ 3个回答
关闭
关闭
QQ
交流群
邀请
好友
App
下载
意见
反馈
返回
顶部