记点笔记
1、一直以为int以下不能计算,这是我的误区啊
short a = 2;
short b = 4;
short c =(short) (a+b);
int d = a+b;
int ds= a+d;
其实都是转到int,结果也是int而已,并不存在不能计算的问题,当然,boolean不行
2、continue这个跳转有点意思
label:
for (int i = 0; i < 100; i++) {
//make the thing you love
continue label;
}
注意,请注意,label:写的地方要求死了的,必须静静跟着循环体,别的都会报找不到错误,当然,你嵌套几个循环体无所谓,这样也行
label:
for (int i = 0; i < 100; i++) {
for (int j = 0; j < 55; j++) {
//make the thing you love
continue label;
}
}
那个i的值可不是每次重新赋值,是累加的
3、跳出多层循环的还有break
break比continue的现只要少一些,只要在控制流前就行,无论是循环还是判断,如下面例子
public static void main(String[] args) {
boolean flag =true;
er:
if (flag) {
//er://此处亦可
flag= false;
//er://此处亦可
for (int k = 0; k < 55; k++) {
label:
for (int i = 0; i < 100; i++) {
for (int j = 0; j < 55; j++) {
//make the thing you love
if (j==1) {
continue label;
}else {
System.out.println(j);
break er;
}
}
}
}
}
System.out.println("居然克拉");
}
最后打印
0
居然克拉
分享到:
相关推荐
里面介绍的 很详细auto break case char const continue default do double else enum extern float for goto if int long register return short signed sizeof static struct switch typedef unsigned union void ...
if语句 、switch语句 、for循环、break、continue、while、do-while总结 if语句 对比if语句switch语句 1、if语句作用的数据类型:boolean类型。而switch语句作用的类型:byte,short,int,char,String。 2、编码...
short占用两个字节,数字大小为-215—215-1 int占用四个字节,数字大小为-231—231-1 long占用八个字节,数字大小为-263—263-1 float占用四个字节,数字大小为1.4E-45~3.4E+38 , -1.4E-45~-3.4E+38 。 用...
标准的语句控制: Begin/End, If/Then/Else, For/To/Downto/Do, Case x Of, Repeat/Until, While, uses, Exit, Continue, Break 3.函数(可以定义在脚本内部或脚本外部)4.标准的数据类型: Byte, Shortint, Char, Word,...
标准语言结构包括:Begin/End、If/Then/Else、For/To/Downto/Do、Case x Of、Repeat/Until、While、uses、Exit、Continue、Break;函数支持;标准类型:Byte, Shortint, Char, Word, SmallInt, Cardinal, Longint, ...
continue default do double else enum extern float for goto if int long register return short signed sizeof static struct switch typedef union unsigned void Volatile while 说明: 1、关键字auto用于说明...
标准语言结构包括:Begin/End、If/Then/Else、For/To/Downto/Do、Case x Of、Repeat/Until、While、uses、Exit、Continue、Break;函数支持;标准类型:Byte, Shortint, Char, Word, SmallInt, Cardinal, Longint, ...
标准语言结构包括:Begin/End、If/Then/Else、For/To/Downto/Do、Case x Of、Repeat/Until、While、uses、Exit、Continue、Break;函数支持;标准类型:Byte, Shortint, Char, Word, SmallInt, Cardinal, Longint, ...
"auto", "break", "case", "char", "const", "continue", "default", "do", "double", "else", "enum", "extern", "float", "for", "goto", "if", "int", "long", "register", "return", "short", ...
auto double int struct break else long switch case enum register typedef char extern return union const float short unsigned continue for signed void default goto sizeof volatile do if while static
break; case 3: k=1; break; case 4: k=1; break; case 5: k=2; break; case 6: k=3; break; case 7: k=3; break; case 8: k=3; break; case 9: k=2; break; } m_VERScrollBar.SetMax(65536...
All common types like Byte, Shortint, Char, Word, SmallInt, Cardinal, Longint, Integer, String, Real, Double, Single, Extended, Boolean, Array, Record, Enumerations, Variants Allows the ...
short unsigned continue for signed void default goto sizeof volatile do if static while asm _cs _ds _es _ss cdecl far huge interrupt near pascal class public private catch protected delete new ...
break - 2 - byte - 2 - case - 3 - catch - 3 - char - 4 - class - 4 - continue - 5 - default - 5 - do - 6 - double - 6 - else - 6 - extends - 6 - false - 7 - final - 7 - finally - 7 - float - 8 - for -...
break case char:数据类型,用于表示一个字符 const continue default do double:数据类型:用于表示一个双精度浮点型数据 else enum extern float:数据类型,用于表示一个单精度浮点型...
"auto"|"double"|"int"|"struct"|"break"|"else"|"long"|"switch"|"case"|"enum"|"register"|"typedef"|"char"|"extern"|"return"|"union"|"const"|"float"|"short"|"unsigned"|"continue"|"for"|"signed"|"void"|...
char reserve[40][10]={"auto","break","case","char","class","const","continue", "default","delete","do","double","else","enum","extern","float","for","friend","if","inline","int","long","new", ...
C语言的基本符号与词汇 大小写英文字母,各26个。 阿拉伯数字0-9,共10个。 其他特殊符号 空格 !# % ^ & * - + = ~ < > / ...continue static long switch register short case float default double if struc
"auto" , "break" , "case" , "char" , "const" , "continue" , "default" , "do" , "double" , "else" , "enum" , "extern" , "float" , "for" , "goto" , "if" , "int" , "long" , "register" , "return" , ...
const float short unsigned continue for signed void default goto sizeof volatile do while static f 标识符: (常量名,变量名,过程名) 1. 所有标识符必须由一个字母(a~z或A~Z)或下划线(_)开头; 2. 标识符的...