C# FAQ: What are the differences between CSharp and Java keywords

Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio


Jump to: navigation, search
CSharp-Online.NET:FAQs
edit

What are the differences between C# and Java keywords?

Despite the close family ties between the two languages, there are significant differences between the C# and Java language keywords.

The following are the C# keywords and their direct Java equivalents—if any:

Keywords in the C# and Java Languages
C# Java C# Java C# Java C# Java
abstract abstract extern native operator na throw throw
as na false false out na true true
base super finally finally override na try try
bool boolean fixed na params typeof na
break break float float partial na uint na
byte na for for private private ulong na
case case foreach for protected na unchecked na
catch catch get na public public unsafe na
char char goto goto1 readonly na ushort na
checked na if if ref na using import
class class implicit na return return value na
const const1 in na sbyte byte virtual na
continue continue int int sealed final void void
decimal na interface interface set na volatile volatile
default default internal protected short short where extends
delegate na is instanceof sizeof na while while
do do lock synchronized stackalloc na yield na
double double long long static static : extends
else else namespace package string na : implements
enum na new new struct na na strictfp
event na null null switch switch na throws
explicit na object na this this na transient2

na means there is no equivalent keyword in that language.

1 Although const and goto are Java keywords, actually, they are unused in the Java language.

2 In C#, the [NonSerialized] attribute is equivalent to the transient keyword in the Java language.

See also



Personal tools