您好,欢迎访问三七文档
当前位置:首页 > 电子/通信 > 数据通信与网络 > Java第02章--1(语言基础)
JavaJavapenggang@mail.hust.edu.cnJavaJava2.1Java2.2Java2.3Java2.4Java2.1JavaJavaJavaJavaUnicodeASCIIJava,Unicode16(ASCII8)ASCIIUnicodeJavaa·····z/,{,}······ASCII1JavaIdentifierReservedWord2.2JavaJavaJavaJavatypesystemprimitivereferencenullcharnumericbooleanclassinterfacearrayintegralfloating-pointbyteshortintlongfloatdouble2Java——Java2.1bitsboolean1bittruefalsebyte8bits-128~127char16bits‘\u0000’~‘\uFFFF’short16bits-32768~32767int32bits-2147483648~2147483647long64bits-9223372036854775808L~9223372036854775807Lfloat32bits1.402398E-45F~3.4028E+38F6~7double64bits4.940656E-324D~1.7976E+308D15~162JavaConstantVariableDataTypePrimaryDataTypesCompositeDataTypesJava2.2Java5Java1231.23‘a’truefalse“Thisisaconstantstring.”CC++Java#definefinalfinalTypevarName=value[,varName[=value]…];finalintglobalAccount=100,nationalAccount=50;finaldoublePI=3.141592.2truefalse12.2Java16Unicode‘a’,‘x’,‘A’,‘?’,‘$’,‘\n’‘\u0030’‘a’‘A’Java“”,.2.2“Howdoyoudo!”,“CHINA”,“a”Java‘a’“a”charc;c=‘a’c=“a”Java“”2.2Byte()byteb;b-128127byte82.2float()floatf1;f13.4e-0383.4e+03832floatf1=127.0f;\\fFfloatf2=4.0e38f;\\32\\3.4e382.2double()doubler;r1.7e-3081.7e+30864P78,2.3P79,2.42.2charc;cUnicode16065535Java2.2booleanb;btruefalseJavaC/C++P77,2.2Javafalse00.0nullP75,2.1variableresultmightnothavebeeninitialized2.2~2.42.2CC++CC++{intx=7;{floatx=3.1;//JavaC/C++}//}C/C++Javaforifor(inti=0;i;i++){}……for(inti=0;i;i++){}2Java——-----------------------------------------------------byte,short,char—int—long—float—double12byteshortcharintintbyteshortcharintlonglongbyteshortcharintlongfloatfloatbyteshortcharintlongfloatdoubledoubleJavareferencenull++--==!=theObject==nullotherObject!=theObjectinstanceoftheObjectinstanceofObject“”instanceofString2.3JavaJava(())3JavaOperatorExpressionCodeBlockScope2.3long,int,short,char&&(()),0,0&=&===========002.3001010100()(0):10101000(168)a=42,a2;00101010():00001010(10)a=42,a2;2.311011002:0011001111011002:11110011!==b=2b=b2a=2a=a22.4JavaJava4Javaif-else,switchwhile,do-while,forbreak,continue,returntry-catch-finally,throwJavaCC++truefalseCC++a:{//a……b:{//b……c:{//c……breakb;……//}//c……//}//b……//}//abreakLabelouter:for(inti=0;i10;i++)//{inner:for(intj=0;j10;j++)//{if(ij){……continueouter;}……//……//P102,2.10for(inti=0;i10;i++){if(i==5){continue;}……}4Java——continue12JavaJava1Java
本文标题:Java第02章--1(语言基础)
链接地址:https://www.777doc.com/doc-5141372 .html