There are a large number of syntactic similarities between Java and C#, similarly almost every Java keyword has a C# equivalent except for a few like transient, throws and strictfp. Below is a table of Java and C# keywords with the Java keywords in red while the equivalent C# keywords are in blue.
NOTE: Although
NOTE: The
| C# keyword | Java keyword | C# keyword | Java keyword | C# keyword | Java keyword | C# keyword | Java keyword |
| abstract | abstract | extern | native | operator | N/A | throw | throw |
| as | N/A | false | false | out | N/A | true | true |
| base | super | finally | finally | override | N/A | try | try |
| bool | boolean | fixed | N/A | params | ... | typeof | N/A |
| break | break | float | float | partial | N/A | uint | N/A |
| byte | N/A | for | for | private | private | ulong | N/A |
| case | case | foreach | for | protected | N/A | unchecked | N/A |
| catch | catch | get | N/A | public | public | unsafe | N/A |
| char | char | goto | goto1 | readonly | N/A | ushort | N/A |
| checked | N/A | if | if | ref | N/A | using | import |
| class | class | implicit | N/A | return | return | value | N/A |
| const | const1 | in | N/A | sbyte | byte | virtual | N/A |
| continue | continue | int | int | sealed | final | void | void |
| decimal | N/A | interface | interface | set | N/A | volatile | volatile |
| default | default | internal | protected | short | short | where | extends |
| delegate | N/A | is | instanceof | sizeof | N/A | while | while |
| do | do | lock | synchronized | stackalloc | N/A | yield | N/A |
| double | double | long | long | static | static | : | extends |
| else | else | namespace | package | string | N/A | : | implements |
| enum | N/A | new | new | struct | N/A | N/A | strictfp |
| event | N/A | null | null | switch | switch | N/A | throws |
| explicit | N/A | object | N/A | this | this | N/A | transient2 |
goto and const are Java language keywords they are unused in the Java language.NOTE: The
[NonSerialized] attribute in C# is equivalent to the transient keyword in Java.
No comments:
Post a Comment