C++與Java中關鍵字的區別

關鍵字(保留字)是編程語言中被賦予特殊意義的單詞,是整個語言範圍內預先保留的標識符,不能用來聲明對象、變量、函數、類名和參數等等標識符。

百科上有詳細的解釋:C++關鍵字Java關鍵字

C++中的關鍵字

下面列出了C++(C++11)中的所有關鍵字(共73個),與Java中不同的用紅色標出:

alignas const_cast extern noexcept static_assert union
alignof constexpr false nullptr static_cast unsigned
asm continue float operator struct using
auto decltype for private switch virtual
bool default friend protected template void
break delete goto public this volatile
case do if register thread_local wchar_t
catch double inline reinterpret_cast throw while
char dynamic_cast int return true
char16_t else long short try
char32_t enum mutable signed typedef
class explicit namespace sizeof typeid
const export new static typename

Java中的關鍵字

下面列出了Java中的關鍵字(共50個):

abstract continue for new switch
assert default goto package synchronized
boolean do if private this
break double implements protected throw
byte else import public throws
case enum instanceof return transient
catch extends int strictfp try
char final interface short void
class finally long static volatile
const float native super while
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章