全民快乐8

你当前所在位置:全民快乐8 > IT就业问题 > Java面试题及答案(4/19)——反射

Java面试题及答案(4/19)——反射

57. 什么是反射?

 

FANSHEZHUYAOSHIZHICHENGXUKEYIFANGWEN、JIANCEHEXIUGAITABENSHENZHUANGTAIHUOXINGWEIDEYIZHONGNENGLI。

 

JavaFANSHE:

 

全民快乐8ZAIJavaYUNXINGSHIHUANJINGZHONG,DUIYURENYIYIGELEI,NENGFOUZHIDAOZHEIGELEIYOUNAXIESHUXINGHEFANGFA?DUIYURENYIYIGEDUIXIANG,NENGFOUDIAOYONGTADERENYIYIGEFANGFA。

 

JavaFANSHEJIZHIZHUYAOTIGONGLEYIXIAGONGNENG:

 

全民快乐8● ZAIYUNXINGSHIPANDUANRENYIYIGEDUIXIANGSUOSHUDELEI。

全民快乐8● ZAIYUNXINGSHIGOUZAORENYIYIGELEIDEDUIXIANG。

● ZAIYUNXINGSHIPANDUANRENYIYIGELEISUOJUYOUDECHENGYUANBIANLIANGHEFANGFA。

● ZAIYUNXINGSHIDIAOYONGRENYIYIGEDUIXIANGDEFANGFA。

 

58. 什么是 java 序列化?什么情况下需要序列化?

 

JIANDANSHUOJIUSHIWEILEBAOCUNZAINEICUNZHONGDEGEZHONGDUIXIANGDEZHUANGTAI(YEJIUSHISHILIBIANLIANG,BUSHIFANGFA),BINGQIEKEYIBABAOCUNDEDUIXIANGZHUANGTAIZAIDUCHULAI。SUIRANNIKEYIYONGNIZIJIDEGEZHONGGEYANGDEFANGFALAIBAOCUNobject states,DANSHIJavaJINITIGONGYIZHONGYINGGAIBINIZIJIHAODEBAOCUNDUIXIANGZHUANGTAIDEJIZHI,NEIJIUSHIXULIEHUA。

 

SHENMEQINGKUANGXIAXUYAOXULIEHUA:

 

a)DANGNIXIANGBADENEICUNZHONGDEDUIXIANGZHUANGTAIBAOCUNDAOYIGEWENJIANZHONGHUOZHESHUJUKUZHONGSHIHOU;

全民快乐8b)DANGNIXIANGYONGTAOJIEZIZAIWANGLUOSHANGCHUANSONGDUIXIANGDESHIHOU;

c)DANGNIXIANGTONGGUORMICHUANSHUDUIXIANGDESHIHOU;

 

59. 动态代理是什么?有哪些应用?

 

DONGTAIDAILI:

 

DANGXIANGYAOJISHIXIANLEMOUGEJIEKOUDELEIZHONGDEFANGFA,JIAYIXIEEWAIDECHULI。BIRUSHUOJIARIZHI,JIASHIWUDENG。KEYIJIZHEIGELEICHUANGJIANYIGEDAILI,GUMINGSIYIJIUSHICHUANGJIANYIGEXINDELEI,ZHEIGELEIBUJINBAOHANYUANLAILEIFANGFADEGONGNENG,ERQIEHAIZAIYUANLAIDEJICHUSHANGTIANJIALEEWAICHULIDEXINLEI。ZHEIGEDAILILEIBINGBUSHIDINGYIHAODE,SHIDONGTAISHENGCHENGDE。JUYOUJIEOUYIYI,LINGHUO,KUOZHANXINGQIANG。

 

DONGDAILIDEYINGYONG:

 

● SpringDEAOP

● JIASHIWU

● JIAQUANXIAN

● JIARIZHI

 

60. 怎么实现动态代理?

 

SHOUXIANBIXUDINGYIYIGEJIEKOU,HAIYAOYOUYIGEInvocationHandler(JIANGSHIXIANJIEKOUDELEIDEDUIXIANGCHUANDIJITA)CHULILEI。ZAIYOUYIGEGONGJULEIProxy(XIGUANXINGJIANGQICHENGWEIDAILILEI,YINWEIDIAOYONGTADEnewInstance()KEYICHANSHENGDAILIDUIXIANG,QISHITAZHISHIYIGECHANSHENGDAILIDUIXIANGDEGONGJULEI)。LIYONGDAOInvocationHandler,PINJIEDAILILEIYUANMA,JIANGQIBIANYISHENGCHENGDAILILEIDEERJINZHIMA,LIYONGJIAZAIQIJIAZAI,BINGJIANGQISHILIHUACHANSHENGDAILIDUIXIANG,ZUIHOUFANHUI。


课程预约