java_java 面试题

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

251.100(JDBC)2.String,StringBufferStringBuilder(CoreJava)StringStringBufferStringBufferStringStringBuffertoString()StringBuilderJDK5StringBufferStringBuilder3.(CoreJava)publicString[]split(Stringstr,intchars){intn=(str.length()+chars-1)/chars;Stringret[]=newString[n];for(inti=0;in;i++){if(in-1){ret[i]=str.substring(i*chars,(i+1)*chars);}else{ret[i]=str.substring(i*chars);}}returnret;}4.javajavasciprt(CoreJava)javascriptJavaJavaSUNInternetjavascriptNetscapeNetscapeNavigator,Web,LiveScriptJavaOak1JavajavascriptObjectBasedEventDriver2Javajavascript3Javajavascript45.floatf=1.3(CoreJava):floatf=(float)1.36.true(CoreJava)ABA“beijing”==“beijing”B“beijing”.equalsIgnoreCasenewString“beijing”7.ExampleAExceptionExampleBExampleA(CoreJava)try{thrownewExampleB(“b”)}catchExampleAe{System.out.printfln“ExampleA”}catchExceptione{System.out.printfln“Exception”}AAExampleABExceptionCbD8.java,?(CoreJava)ThreadRunnablesynchronized,waitnotify9.ArraylistVector(CoreJava)ArrayListVector1.:VectorArrayList2.:,VectorArrayList10.HashMapHashtable(CoreJava)Map1.:HashtableDictionaryHashMapJava1.2Map2.:HashtableHashMap3.HashMapkeyvalue4.HashMapHashtablecontainscontainsvaluecontainsKeycontains11.CollctionCollections(CoreJava)Collectionsjava.utilCollectionjava.util12.(CoreJava)12313.OverloadOverrideOverloaded(CoreJava)OverridingOverloadingJavaOverridingOverloading(Overriding)“”(Overloading)Overloaded14.AB(CoreJava)classA{inta=1;doubled=2.0;voidshow(){System.out.println(ClassA:a=+a+\td=+d);}}classBextendsA{floata=3.0f;Stringd=Javaprogram.;voidshow(){super.show();System.out.println(ClassB:a=+a+\td=+d);}}(1)mainAa=newA();a.show();ClassA:a=1d=2.0(2)mainBbAb=newB();b.show();ClassA:a=1d=2.0ClassB:a=3.0d=Javaprogram.15.(CoreJava)(JAVA)()abstractclassabstractAbstractinterfacestaticfinal16.MVC(Web)JavaWebMVCmodelviewcontrolWEBModelViewMODELControlformMODELVIEW17.bankNo(Web)javajavascriptJavarequest.getParameter(“bankNo”);javascriptvarselectItems=document.getElementsByName(“bankNo”);selectItems[0].value;18.javasct(Web)19.web(Web)tomcatweblogiceclipse,jbuilder20.Servlet2.2WebApplication2(Web)webapps|Applocation|||JSPWEB-INF||||Classlibweb.xml21.DJGEBKNIFCAA/\BC/\\DEF//\GNI/\JK22.C++voidswap(int&a,int&b){intc=a;a=b;b=c;}voidbubble(int*p,intlen){boolbSwapped;do{bSwapped=false;for(inti=1;ilen;i++){if(p[i-1]p[i]){swap(p[i-1],p[i]);bSwapped=true;}}}while(bSwapped);}23.byte()8bit24.UNIX(Linux)10(Unix)lspwdmkdirrmcpmvcdpsftptelnetpingenvmoreecho25.;(C++).,#includemath.hboolprime(intn){if(n=0)exit(0);for(inti=2;i=n;i++)for(intj=2;j=sqrt(i);j++)if((n%j==0)&&(j!=n))returnfalse;returntrue;}C++371.,S,C,SC,,,SC(SQL)1)mysqlcreatetables(idintegerprimarykey,namevarchar(20));createtablec(idintegerprimarykey,namevarchar(20));createtablesc(sidintegerreferencess(id),cidintegerreferencesc(id),primarykey(sid,cid));2)SQL,SQLselectstu.id,stu.namefromsstuwhere(selectcount(*)fromscwheresid=stu.id)=(selectcount(*)fromc);3)SQL,5SQLselectstu.id,stu.namefromsstuwhere(selectcount(*)fromscwheresid=stu.id)=5;2.(Test)(SQL)IDNAMEAGEMANAGER(ID)106A30104109B19104104C20111107D35109112E25120119F45NULL:ID?SQLselectemployee.namefromtestemployeewhereemployee.age(selectmanager.agefromtestmanagerwheremanager.id=employee.manager);3.315(SQL)Student()Course()Sc()1)SQL’’3SQLselectstu.sno,stu.snamefromStudentstuwhere(selectcount(*)fromscwheresno=stu.snoandcno=(selectcnofromCoursewherecname=''))!=0;2)SQL’’3SQLselectcnamefromCoursewherecnoin(selectcnofromscwheresno=(selectsnofromStudentwheresname=''));3)SQL59SQLselectstu.sno,stu.snamefromstudentstuwhere(selectcount(*)fromscwheresno=stu.sno)=5;4.j1j1(CoreJava)packagetest;publicclassTestThread{intj;publicTestThread(intj){this.j=j;}privatesynchronizedvoidinc(){j++;System.out.println(j+--Inc--+Thread.currentThread().getName());}privatesynchronizedvoiddec(){j--;System.out.println(j+--Dec--+Thread.currentThread().getName());}publicvoidrun(){(newDec()).start();newThread(newInc()).start();(newDec()).start();newThread(newInc()).start();}classDecextendsThread{publicvoidrun(){for(inti=0;i100;i++){dec();}}}classIncimplementsRunnable{publicvoidrun(){for(inti=0;i100;i++){inc();}}}publicstaticvoidmain(String[]args){(newTestThread(5)).run();}}5.,,(CoreJava)publicintcountWords(Stringfile,Stringfind)throwsException{intcount=0;Readerin=newFileReader(file);intc;while((c=in.read())!=-1){while(c==find.charAt(0)){for(inti=1;ifind.length();i++){c=in.read();if(c!=find.charAt(i))break;if(i==find.length()-1)count++;}}}returncount;}6.sleep()wait()(CoreJava)sleep()sleep(a)“”(b)wait()xwait()7.GC(CoreJava)GCJavaSystem.gc()Runtime.getRuntime().gc()8.101-10(CoreJava)packagetest;importjava.util.ArrayList;importjava.util.Collections;importjava.util.Iterator;importjava.util.List;importjava.util.Random;publicclassRandomSort{publicstaticvoidprintRandomBySort(){Randomrandom=newRandom();//Listlist=newArrayList();for(inti=0;i10;i++){//10listlist.add(random.nextInt(1000));}Collections.sort(list);//Iteratorit=list.iterator();intcount=0;while(it.hasNext()){//System.out.println(++cou

1 / 22
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功