Java / C# differences part 1 of n

Recently I’ve been toying around with Android development (since I own an Android “smart” phone for over 2 years now) and mobile development is all the rage now. Moreover, I’ve been trying to do new things lately since even the pragmatic programmer guide advises us to learn a new language each year (kind of aggressive if you ask me).

Anyway I will try to show what a C# developer (almost 8 years now) discovers by doing Java development on Eclipse for Android.

For today :

leaving a member of a class without an access modifier defaults to internal instead of private :

// C#
void Test() // private method
// Java
void test() { // internal method

Overriding a method does not require any kind of keyword or special ceremony. You can use the @Override annotation but this is optional. You can get burned this way easily.

// C#
public override bool Equals(object other)
    return _id == other._id;
public bool equals(Person other) {
    return ==;

public bool equals(Object other) {
    return ==;

Overriding requires that you use the same method signature (that is, the same return type, the same parameter types and order). If you accidentally mistake the signature (Person instead of Object) you will overload instead of overriding with unknown effects.

In other “news”, Android development has a lot of similarities with WPF :

  • You have activities (similar to pages in Silverlight/WPF).
  • These are XML-defined.
  • There are a few base-layout controls (viewobjects) like LinearLayout (StackPanel), GridLayout and so on.
  • You must not access UI elements from other threads than the main / UI thread.
  • The layout viewobjects have similar properties to the layout controls in WPF/Silverlight : width/height which can be specified absolutely or relatively and so on.

The lack of properties baked in the language is annoying regardless of the features of Eclipse (generate getters and setters). The auto-complete feature is far from Visual Studio and there is no “ReSharper” to easily import missing types. Yes there is F2 but still..

The lack of delegates makes multithreading a pain (you know where this pain is located) and so is the wiring of the handlers for clicking buttons and all.

Oh well, I’ll carry on and be back with new opinions as I go.

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

WP Like Button Plugin by Free WordPress Templates