Java Versus .NET Languages

Note

To do a decent comparison between the CLR and a JVM, it makes sense to install Java. The discussions in this Appendix assume use of Java 1.4 of Java and the associated PDK from Sun (http://developer.java.sun.com/developer/index.jshtml).

Look at Listing D.1, which shows the simplest of Java programs.

Listing D.1. Hello World in Java
// To compile and run
// javac -classpath . helloworld.java
// java HelloWorld
// (case is important)
class HelloWorld
{
    public static void main(String[] args)
    {
        System.out.println("Hello World from Java!");
    }
}

Compiling this program produces a class file called HelloWorld.class. To run the program, type java HelloWorld. With Java, you specify a class name to run. Running this program ...

Get .NET Common Language Runtime Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.