订阅所有JSP/Servlet的日志 订阅 | 这是最新一篇日志 上一篇 | 下一篇日志 下一篇 ]
收集转载

java中的50个关键字和关键字的意思

Abstract 抽象的
一个Java语言中的关键字,用在类的声明中来指明一个类是不能被实例化的,但是可以被其它类继承。一个抽象类可以使用抽象方法,抽象方法不需要实现,但是需要在子类中被实现
break
一个Java的关键字,用来改变程序执行流程,立刻从当前语句的下一句开始执行从。如果后面跟有一个标签,则从标签对应的地方开始执行
case

Java语言的关键字,用来定义一组分支选择,如果某个值和switch中给出的值一样,就会从该分支开始执行。
catch
Java的一个关键字,用来声明当try语句块中发生运行时错误或非运行时异常时运行的一个块。
char
Java语言的一个关键字,用来定义一个字符类型



continue
一个Java的关键字,用来打断当前循环过程,从当前循环的最后重新开始执行,如果后面跟有一个标签,则从标签对应的地方开始执行。
do
一个Java语言的关键字,用来声明一个循环,这个循环的结束条件可以通过while关键字设置
double
一个Java语言的关键字,用来定义一个double类型的变量
else
一个Java语言的关键字,如果if语句的条件不满足就会执行该语句。
final
一个Java语言的关键字。你只能定义一个实体一次,以后不能改变它或继承它。更严格的讲:一个final修饰的类不能被子类化,一个final修饰的方法不能被重写,一个final修饰的变量不能改变其初始值。
finally
一个Java语言的关键字,用来执行一段代码不管在前面定义的try语句中是否有异常或运行时错误发生。
float
一个Java语言的关键字,用来定义一个浮点数变量
for
一个Java语言的关键字,用来声明一个循环。程序员可以指定要循环的语句,推出条件和初始化变量。
if
Java编程语言的一个关键字,用来生成一个条件测试,如果条件为真,就执行if下的语句。
implements
Java(TM)编程语言的一个关键字,在类的声明中是可选的,用来指明当前类实现的接口。
import
Java(TM)编程语言的一个关键字,在源文件的开始部分指明后面将要引用的一个类或整个包,这样就不必在使用的时候加上包的名字。
instanceof
一个二操作数的Java(TM)语言关键字,用来测试第一个参数的运行时类型是否和第二个参数兼容。
int
Java(TM)的一个关键字,用来定义一个整形变量
Java(TM)的一个关键字,用来定义一系列的方法和常量。它可以被类实现,通过implements关键字。
long

Java语言的一个关键字,用来定义一个long类型的变量。
private
Java语言的一个关键字,用在方法或变量的声中。它表示这个方法或变量只能被这个类的其它元素所访问。
protected
Java语言的一个关键字,在方法和变量的声明中使用,它表示这个方法或变量只能被同一个类中的,子类中的或者同一个包中的类中的元素所访问。
public
Java语言的一个关键字,在方法和变量的声明中使用,它表示这个方法或变量能够被其它类中的元素访问。
return
Java语言的一个关键字,用来结束一个方法的执行。它后面可以跟一个方法声明中要求的值。
short
Java语言的关键字,用来定义一个short类型的变量。
static
Java语言的关键字,用来定义一个变量为类变量。类只维护一个类变量的拷贝,不管该类当前有多少个实例。"static" 同样能够用来定义一个方法为类方法。类方法通过类名调用而不是特定的实例,并且只能操作类变量。

this
Java语言的关键字,用来代表它出现的类的一个实例。this可以用来访问类变量和类方法。
throw
Java语言的关键字,允许用户抛出一个exception对象或者任何实现throwable的对象
throws
Java语言的关键字,用在方法的声明中来说明哪些异常这个方法是不处理的,而是提交到程序的更高一层。

transient
Java语言的关键字,用来表示一个域不是该对象串行化的一部分。当一个对象被串行化的时候,transient型变量的值不包括在串行化的表示中,然而非transient型的变量是被包括进去的。
try
Java语言的关键字,用来定义一个可能抛出异常语句块。如果一个异常被抛出,一个可选的catch语句块会处理try语句块中抛出的异常。同时,一个finally语句块会被执行,无论一个异常是否被抛出。


void
Java语言的关键字,用在Java语言的方法声明中说明这个方法没有任何返回值。"void"也可以用来表示一句没有任何功能的语句。
volatile
Java语言的关键字,用在变量的声明中表示这个变量是被同时运行的几个线程异步修改的。

while
Java语言的一个关键字,用来定义一段反复执行的循环语句。循环的退出条件是while语句的一部分。


关于break和continue。

continue语句与break语句相关,但较少用到。continue语句用于使其所在的for、while或do-while语句开始下一次循环。在while与do-while语句中,continue语句的执行意味着立即执行测试部分;在for循环语句中,continue语句的执行则意味着使控制传递到增量部分。

测试代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
public class LabledFor { 
//static Test monitor = new Test(); 
public static void main(String[] args) { 
int i = 0; 
outer: 
for(; true ;) { 
inner: 
for(; i < 10; i++) { 
System.out.println("i = " + i); 
if(i == 2) { 
System.out.println("continue"); 
continue; 
} 
if(i == 3) { 
System.out.println("break"); 
i++; 
break; 
} 
if(i == 7) { 
System.out.println("continue outer"); 
i++; 
continue outer; 
} 
if(i == 8) { 
System.out.println("break outer"); 
break outer; 
} 
 
for(int k = 0; k < 5; k++) { 
if(k == 3) { 
System.out.println("continue inner"); 
continue inner; 
} 
} 
} 
} 
} 
 
} 


结果
i = 0
continue inner
i = 1
continue inner
i = 2
break
i = 3
continue
i = 4
continue inner
i = 5
continue inner
i = 6
continue inner
i = 7
continue outer
i = 8

平均得分
(0 次评分)





文章来自: 百度知道
标签: 关键字 
评论: 10 | 查看次数: 4281
  • 共有 10 条评论
beeflee [2009-08-03 22:14:43]
beeflee [2009-06-09 12:32:18]
beeflee [2009-04-29 15:14:52]
游客 [2008-11-18 19:43:20]
游客 [2008-11-10 16:56:17]
It was cold in Arathi. des po wow The weather was neve. free online games r agreeable to. free online war games Captain Abel Marsh. gold für wow He was born to the免费网络游戏 nation Stromgarde. gold in wow and had lived amidst the. gold wow rolling hills and rocks of his homeland for nearly forty years. gold wow Yet no matter how. mp3 player long he lived he最新网游 would never get. online games used to the frigid . play war games air that permeated the. po wow countryside during the winter. world of warcraft gold Marsh clutched his cloak closer to his chest in a bid for additional warmth. world of wow He sometimes fancied the idea of spiriting off to some. wow europe land with a warmer more favorable climate. wow geld But any plans he hatched . wow geld to do just that never came to any fruition. wow gold 1000 When he was younger he might have traveled south. wow gold 5000 to the nation of Stormwind, but that was also. wow gold billig a failed plan. wow gold günstig Just as well he thought. wow gold verkaufen better to be freezing. wow level service up north. wow leveling service than a slave to the orcs. wow mein gold de Marsh stepped out of his tent. wow po that overlooked a. wow powerlevel small military camp.
游客 [2008-11-10 16:55:03]
For ten thousand years. wow gold the immortal night elves. 8GB MP3 PLAYER cultivated a druidic society . apple ipod within the shadowed网络游戏 recesses of. buy cheap wow gold Ashenvale Forest. canon digital camera Then the catastrophic. cheap world of warcraft gold invasion of the Burning Legion. digital camera shattered the tranquility of. digital cameras their ancient. dvd player civilization. eve isk Led by the Arch网游Druid Malfurion. ipod Stormrage and the Priestess. ipod nano Tyrande Whisperwind. ipod shuffle the mighty night elves rose. ipod touch to challenge the demonic onslaught. ipods Aided by the newly. mp3 arrived orcs and humans. mp3 player the night elves succeeded. mp3 players in halting the Legion's. mp4 advance and. portable dvd players defeating its master. world of warcraft buy gold the demonlord Archimonde. wow Though victorious. wow gold the night elves were forced. wow leveling to sacrifice their. wow powerleveling cherished immortality. zubehoer mp3 player and watch their beloved forests burn.
游客 [2008-11-10 16:54:01]
In the aftermath of the horrific conflict. wow gold Malfurion and Tyrande helped their. 2GB MP3 PLAYER people rebuild游戏 their shattered villages. wow gold Slowly the night elves began. 4GB MP3 PLAYER to adjust to their mortal existence. wow gold Such an adjustment. buy wow gold was far from easy. wow gold and there were many night elves. buying gold world of warcraft who could not adjust to the prospects of aging. wow gold disease, and fraility. cell phones Seeking to regain魔兽 their immortality. cheap cell phones a number of wayward druids. cheap wow gold conspired to plant a special. cheap wow gold tree that would reestablish. cheap wow gold a link between their spirits. cheapest wow gold and the eternal world. eve isk When Malfurion heard. mp3 players about this plan. phones cell he warned that nature. portable mp3 player would never bless such a selfish act. portable mp3 players Shortly thereafter. sell wow gold Malfurion's spirit was. world of warcraft gold somehow lost within the depths. wow of the Emerald Dream. wow gold Though his fellow druids. wow gold kaufen attempted to find his wandering spirit. wow gold kaufen only his body remained sleeping within his Barrow Den.
游客 [2008-11-10 16:53:18]
When she awakened Sayvil was already hard at work. cheap wow power leveling directing her other assistants. cheapest wow gold rather than healing the. gold wow soldiers herself. HDRO gold her own strength exhausted. level wow from the night before. lord of rings online gold Alireana.最新免费网络游戏good you are awake. lotro gold Come here a moment. lotro gold I have a task for you. or wow Your gifts arewowgold with healing minds. power level rather than bodies as mine is. wowgold I have told you the story. power level of the things done to Niyara. serveur wow I would like you to find her and Messira. wow level and see what you can do for her. wow leveling I leave her care in your hands. wow lvl you will know what. wow lvl is best for her. wowgold when the time comes. wow lvl 60 They currently live on Theramore Island. wow lvl 70 withing the Dustwallow Marsh. wow or Alireana nodded once. wow power leveling I will do my best for her. wow powerlevel If I can find her. wow powerlevel She turned to leave. wow powerleveling turning back to smile at Sayvil. I will not fail you. she walked out of the. makeshift hospital heading.
游客 [2008-10-19 10:47:39]
javaapi.cn [2007-11-07 23:21:58]
好文章。推荐,呵
  • 共有 10 条评论
发表评论
昵 称:  登录
内 容:
选 项:
字数限制 1000 字 | UBB代码 开启 | [img]标签 开启