Java vs. C# Flashcards
1
Q
Determine whether a variable is castable to another.
A
Java: instanceOf Object h = new Object(); h instanceof Object -> True C#: is Object h = new Object()l h is Object -> True
2
Q
Call a class’s base class method / member
A
Java: public MyClass( int a ) { super( a ); } C#: public MyClass( int a ) : base( a ) { }
3
Q
Lock an expression / object to make it thread-safe
A
Java: synchronized( x )
C#: lock( x )
4
Q
Create a scope to avoid name collisions, group like classes, etc.
A
C#: namespace
Java: package