Java第02章--1(语言基础)

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

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

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

资源描述

JavaJavapenggang@mail.hust.edu.cnJavaJava2.1Java2.2Java2.3Java2.4Java2.1JavaJavaJavaJavaUnicodeASCIIJava,Unicode16(ASCII8)ASCIIUnicodeJavaa·····z/,{,}······ASCII1Java„Identifier„ReservedWord2.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~162Java‰Constant‰Variable‰DataType„PrimaryDataTypes„CompositeDataTypesJava2.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+03832„floatf1=127.0f;\\fF„floatf2=4.0e38f;\\32\\3.4e382.2double()doubler;r1.7e-3081.7e+30864P78,2.3P79,2.42.2charc;cUnicode16065535Java2.2booleanb;btruefalseJavaC/C++P77,2.2„Java„false„0„0.0„null„„P75,2.1„variableresultmightnothavebeeninitialized„2.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—double12byteshortcharintintbyteshortcharintlonglongbyteshortcharintlongfloatfloatbyteshortcharintlongfloatdoubledouble„Javareference„null„„++--„„==!=„theObject==null„otherObject!=theObject„instanceof„theObjectinstanceofObject„“”instanceofString2.3JavaJava(())3Java„OperatorExpression„CodeBlock„Scope2.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.4JavaJava4Javaƒif-else,switchƒwhile,do-while,forƒbreak,continue,returnƒtry-catch-finally,throwƒJavaCC++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——continue12JavaJava1ƒƒJavaƒ

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

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

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

×
保存成功