This guy here had to make the inverse transition. So he listed the top 10 differences of Java and C#. I'll take his topics and show how it is made in Java:
Gotcha #10 - Give me my standard output!
To print to the standard output in Java:
System.out.println("Hello");
Gotcha #9 - Namespaces == Freedom
In Java you don't have the freedom of namespaces. The folder structure of your class must match the package name. For example, a class in the package org.test must be in the folder org/test
Gotcha #8 - What happened to super?
In Java to refer to the superclass you use the reserved word super instead of base
Gotcha #7 - Chaining constructors to a base constructor
You don't have this in Java. You have to call the constructor by yourself
Gotcha #6 - Dagnabit, how do I subclass an existing class?
To subclass a class in Java do this:
public class A extends B {
}
That means class A is a subclass of class B. In C# would be "class A : B"
Gotcha #5 - Why don’t constants remain constant?
To define a constant in Java use the keyword final instead of const
Gotcha #4 - Where is ArrayList, Vector or Hashtable?
The most used data structures in java are HashSet, ArrayList and HashMap. They implement Set, List and Map. Of course, there is a bunch more. Take a look at http://java.sun.com/docs/books/tutorial/collections/index.html
Gotcha #3 - Of Accessors and Mutators (Getters and Setters)
You don't have the properties facility in Java. You have to declare the gets and sets methods for yourself. Of course, most IDEs can do that automatically.
Gotcha #2 - I can’t override!?
You don't have to declare a method virtual in Java. All methods - except those declared final - can be overridden in Java.
And the #1 gotcha…
In Java the primitive types int, float, double, char and long are not Objects like in C#. All of them have a respective object representation, like Integer, Float, Double, etc.
That's it. Don't forget to see the original link: http://crfdesign.net/programming/top-10-differences-between-java-and-c
There's a more detailed discussion.