Java英文面试题经典.docx

上传人:b****2 文档编号:1342170 上传时间:2022-10-21 格式:DOCX 页数:20 大小:53.39KB
下载 相关 举报
Java英文面试题经典.docx_第1页
第1页 / 共20页
Java英文面试题经典.docx_第2页
第2页 / 共20页
Java英文面试题经典.docx_第3页
第3页 / 共20页
Java英文面试题经典.docx_第4页
第4页 / 共20页
Java英文面试题经典.docx_第5页
第5页 / 共20页
点击查看更多>>
下载资源
资源描述

Java英文面试题经典.docx

《Java英文面试题经典.docx》由会员分享,可在线阅读,更多相关《Java英文面试题经典.docx(20页珍藏版)》请在冰豆网上搜索。

Java英文面试题经典.docx

Java英文面试题经典

Java-英文面试题-经典

英文Java面试题

Question:

Whatistransientvariable?

Answer:

Transientvariablecan'tbeserialize.ForexampleifavariableisdeclaredastransientinaSerializableclassandtheclassiswrittentoanObjectStream,thevalueofthevariablecan'tbewrittentothestreaminsteadwhentheclassisretrievedfromtheObjectStreamthevalueofthevariablebecomesnull.

Question:

NamethecontainerswhichusesBorderLayoutastheirdefaultlayout?

Answer:

ContainerswhichusesBorderLayoutastheirdefaultare:

window,FrameandDialogclasses.

Question:

WhatdoyouunderstandbySynchronization?

Answer:

Synchronizationisaprocessofcontrollingtheaccessofsharedresources

Answer:

TheCollectionAPIisasetofclassesandinterfacesthatsupportoperationoncollectionsofobjects.Theseclassesandinterfacesaremoreflexible,morepowerful,andmoreregularthanthevectors,arrays,andhashtablesifeffectivelyreplaces.

Exampleofclasses:

HashSet,HashMap,ArrayList,LinkedList,TreeSetandTreeMap.

Exampleofinterfaces:

Collection,Set,ListandMap.

 

Question:

IsIteratoraClassorInterface?

Whatisitsuse?

Answer:

IteratorisaninterfacewhichisusedtostepthroughtheelementsofaCollection.

Question:

Whatissimilarities/differencebetweenanAbstractclassandInterface?

Answer:

Differencesareasfollows:

Interfacesprovideaformofmultipleinheritance.Aclasscanextendonlyoneotherclass.

Interfacesarelimitedtopublicmethodsandconstantswithnoimplementation.Abstractclassescanhaveapartialimplementation,protectedparts,staticmethods,etc.

AClassmayimplementseveralinterfaces.Butincaseofabstractclass,aclassmayextendonlyoneabstractclass.

Interfacesareslowasitrequiresextraindirectiontofindcorrespondingmethodintheactualclass.Abstractclassesarefast.

Similarities:

NeitherAbstractclassesorInterfacecanbeinstantiated.

Question:

HowtodefineanAbstractclass?

Answer:

AclasscontainingabstractmethodiscalledAbstractclass.AnAbstractclasscan'tbeinstantiated.

ExampleofAbstractclass:

abstractclasstestAbstractClass{

protectedStringmyString;

publicStringgetMyString(){

returnmyString;

}

publicabstractstringanyAbstractFunction();

}

Question:

HowtodefineanInterface?

Answer:

InJavaInterfacedefinesthemethodsbutdoesnotimplementthem.Interfacecanincludeconstants.AclassthatimplementstheinterfacesisboundtoimplementallthemethodsdefinedinInterface.

EmapleofInterface:

publicinterfacesampleInterface{

publicvoidfunctionOne();

publiclongCONSTANT_ONE=1000;

}

Question:

ExplaintheuserdefinedExceptions?

Answer:

UserdefinedExceptionsaretheseparateExceptionclassesdefinedbytheuserforspecificpurposed.Anuserdefinedcancreatedbysimplysub-classingittotheExceptionclass.Thisallowscustomexceptionstobegenerated(usingthrow)andcaughtinthesamewayasnormalexceptions.

Example:

classmyCustomExceptionextendsException{

//Theclasssimplyhastoexisttobeanexception

}

Question:

ExplainthenewFeaturesofJDBC2.0CoreAPI?

Answer:

TheJDBC2.0APIincludesthecompleteJDBCAPI,whichincludesbothcoreandOptionalPackageAPI,andprovidesinductrial-strengthdatabasecomputingcapabilities.

NewFeaturesinJDBC2.0CoreAPI:

 

Scrollableresultsets-usingnewmethodsintheResultSetinterfaceallowsprogrammaticallymovethetoparticularrowortoapositionrelativetoitscurrentposition

JDBC2.0CoreAPIprovidestheBatchUpdatesfunctionalitytothejavaapplications.

JavaapplicationscannowusetheResultSet.updateXXXmethods.

Newdatatypes-interfacesmappingtheSQL3datatypes

Custommappingofuser-definedtypes(UTDs)

Miscellaneousfeatures,includingperformancehints,theuseofcharacterstreams,fullprecisionforjava.math.BigDecimalvalues,additionalsecurity,andsupportfortimezonesindate,time,andtimestampvalues.

Question:

Explaingarbagecollection?

Answer:

GarbagecollectionisoneofthemostimportantfeatureofJava.GarbagecollectionisalsocalledautomaticmemorymanagementasJVMautomaticallyremovestheunusedvariables/objects(valueisnull)fromthememory.Userprogramcann'tdirectlyfreetheobjectfrommemory,insteaditisthejobofthegarbagecollectortoautomaticallyfreetheobjectsthatarenolongerreferencedbyaprogram.Everyclassinheritsfinalize()methodfromjava.lang.Object,thefinalize()methodiscalledbygarbagecollectorwhenitdeterminesnomorereferencestotheobjectexists.InJava,itisgoodideatoexplicitlyassignnullintoavariablewhennomoreinuse.IJavaoncallingSystem.gc()andRuntime.gc(),JVMtriestorecycletheunusedobjects,butthereisnoguaranteewhenalltheobjectswillgarbagecollected.

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 经管营销 > 人力资源管理

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1