您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 招聘面试 > java_Java 学习笔记
()“”mainpublicstaticvoidmain(String[]args){……}jareclipse-Export--Next-Next-mainclass-finishjar“java-jar./.jar”“.sh”sh“”shComments//……/*……*//**……*/JDKjavadocjavadocHTML:javadoc[options][packagenames][sourcefiles][@files]1.“_”“$”“_”“$”“$”2.3.4.()5.JavaBeanssetgetisaddremove1.()classMyFirstClassinterfaceWeapon2.()booleanisWomanvoidsetName(Stringname)3.publicfinalintGREENpublicfinalintHEAD_COUNT4.Java(Package)packagejava.awt.eventjava.lang.System.gc();/java.lang.Runtime.gc();,System.gc();java.lang.Runtime.gc();mainpackage“.”importjavac-d.javajava.importjava.util.*;//java.utilimportjava.*;“*”()(public)ScannerJ2SE5.0java.util.Scannernext()importjava.util.Scanner;Scanners=newScanner(System.in);System.out.println();System.out.printf(%s\r\n,s.next());System.out.println();System.out.printf(%d\r\n,s.nextInt());BufferedReader//5.0BufferedReaderjava.io.Readerjava.io.InputStreamReader:importjava.io.InputStreamReader;importjava.io.BufferedReader;classtest{publicstaticvoidmain(Stringargs[]){System.out.println();BufferedReaders=newBufferedReader(newInputStreamReader(System.in));Stringnext;try{next=s.readLine();//System.out.println(+next);}catch(Exceptione){}}}+1(+1)()011()9()x0x55()5*16+5()boolean(8bit,)truefalsechar16bit,0~2^16-1(2^16=66)byte8bit,-2^7~2^7-1(2^7=128byteint)short16bit,-2^15~2^15-1(2^15=32768)int32bit,-2^31~2^31-1(2147483648,20,10)long64bit,-2^63~2^63-1(900,20)float32bit,9()()double64bit,18(:1.7e308)floatdoubledoublei=0.01;if(i-0.011E-6)……if(i==0.01)……intdoublelongLlfloatfF12.5E3byteshortintlongfloatdoublechar()intfloat;longfloat;longdouble.0.1java.mathBigDecimalintti;(byte)ti;“final”finalintn1=10;n1=20;System.out.println()System.out.print()System.out.printf()%,,%printf,5%[argument_index$][flags][width][.precision]conversion“”[$][flags][][.][]printf()cFormatterScanner(EscapeSequence)\ddd138Unicode(ddd)\uxxxx1416Unicode(xxxx)\\\\''\\b()\f,\n\r\t%%%%d10ByteShortIntegerLongBigInteger()%f10FloatDoubleBigDecimal(Integer)%e,%E10FloatDoubleBigDecimal%a,%A,16,10,%o(o)8:Byte,Short,Integer,LongBigInteger%x,%X16%s,%S()%c,%CByteShortCharacterInteger%b,%Btruefalse(%BTRUEFALSE);,true,false%t,%T/API/********Unicode*******************/classTest{publicstaticvoidmain(String[]args){Strings=+0+'a';//0=48,9=57//A=65,Z=90;a=97,z=122;=32inti=s.codePointAt(0);intj=s.codePointAt(1);//codePointAt(intindex)System.out.printf(%d%d,i,j);}}/**********************************************/java.lang.Math:Math.abs();Math.sqrt();Math.max(1,2);Math.min(1,2);++str+10+20str102010+20+str30strstr1=str1.concat(str2);str1=str1+str2;++=Stringconcat()length()StringBuffer01)charAt//charcharAt(intindex)2)setCharAt//charsetCharAt(intindex,charc)StringBuffersb=newStringBuffer(abcd);sb.setCharAt(2,'j');//'c''j'3)length//intlength()4)setLength//voidsetLength(intnewLength)null5)capacitylength//intcapacity()6)append//StringBufferappend(Stringstr)7)insert//StringBufferinsert(intoffset,Stringstr)//StringBufferinsert(intoffset,charc)8)delete//StringBufferdelete(intstart,intend);startend-19)replace//StringBufferreplace(intstart,intend,Stringstr)startend-1strStringBuffersb=newStringBuffer(abcd);sb.append(efg);//Stringconcatsb.insert(3,java);//abcjavadefgsb.delete(6,10);//abcjaefg10)Stringstr+='';//char:str+=dd\dd;StringStringBuffer//StringStringBufferStrings1=String1;StringBuffersb1=newStringBuffer(s1);//StringBufferStringStringBuffersb2=newStringBuffer(String2);Stringstr2=sb2.toString();(+)()(*)(/)()2%3=2100%3=1=+=-=*=/=%=(inti=10;i-=5-3;8)======!=(&&||)(&|)!&(AND)|(OR)^(XOR)~()1(1-1):,,20()123312(33%32)121=6int321321“”Objectequals()“”javax=y=z=5;x,y,z5instanceof1booleanc=ainstanceofB//aB2intif(double)doubleelseif(float)floatelseif(long)longelseintif(……){……}else{……}if(……){……}elseif(……){……}else{……}if(……){……if(……){……}else{……}}else{……}switchswitch(charc){casec1:……;break;casec2:……;break;……default:……;}/*switchintintbyte,short,char,Integer,Byte,Short,Characterlong(float,double)Stringcase(Integer,Character)*/for(;;){;}Cforforbooleanforwhile(){……;}do{……;}while(condition);do“{}”whilebreakcontinuebreakcontinuecontinuebreak()JAVAgoto()forifor(inti=0;i10;i++){……}forifor(inti=0;i10;i++){……}for(inti=0;i3;i++){……}forinti;for(i=0;i10;i++){……}fori10abstractbooleanbreakbytecasecatchcharclasscontinuedefaultdodoubleelseextendsenumfalsefinalfinallyfloatforifimplementsimportinstanceofintinterfacelongnativenewnullpackageprivateprotectedpublicreturnshortstaticsuperswitchsynchronizedthisthrowthrowstransienttruetryvoidvolatilewhileJavatruefalse,booleanfriendlysizeofjavaconstgotoCalendarjava.util.CalendarCalendarcal=Calendar.getInstance();intyear=cal.get(Calendar.YEAR);intmonth=cal.get(Calendar.MONTH)+1;//0intdate=cal.get(Calendar.DATE);//intday=cal.get(Calendar.DAY_OF_WEEK);//17inthour=cal.get(Calendar.HOUR_OF_DAY);intmin=cal.get(Calendar.MINUTE);intsec=cal.get(Calendar.SECOND);System.out.println(+year++month++date+);System.out.println(+hour++min++sec+);Calendarafterbeforeequalsafter():CalendarCalendartruefalsebefore():CalendarCalendartruefalsee
本文标题:java_Java 学习笔记
链接地址:https://www.777doc.com/doc-6182566 .html