Skip to content
On this page

2.3 Java中的关键字/保留字

​ Java关键字是Java语言保留供内部使用的,如class用于定义类。 关键字也可以称为保留字,它们的意思是一样的,我们不能使用关键字作为变量名或方法名。

表 2-1 Java 中的关键字/保留字

abstractassertbooleanbreakbytecase
catchcharclassconstcontinuedefault
dodoubleelseextendsfinalfinally
floatforgotoifimplementsimport
instanceofintinterfacelongnativenew
nullpackageprivateprotectedpublicreturn
shortstaticstrictfpsuperswitchsynchronized
thisthrowthrowstransienttryvoid
volatilewhile

菜鸟雷区

​ 出于应试教育的惯性思维,很多新手很可能去背上面的单词,从实战思维出发,我们不需要刻意去记!随着学习的深入,自然就非常熟悉了。