I'll start off with a short overview of what Java is and how it works, move on to basic coverage of some object-oriented programming concepts, and then jump right into creating Java classes -- the heart of Java programming.
I'll try to give examples and instructions that are as platform-neutral as possible, but I'll default to the Windows platform when necessary. Unix users should have an easy time interpreting these examples for the Unix world. Mac and other users will have to work a little harder (our apologies).
Java is a general-purpose, object-oriented language that looks a lot like C and C++. Its design, however, was built on those of its predecessors, making it easier, safer, and more productive than C++. While Java started out as a niche language for developing applets or small programs that run in Web browsers, it has evolved to arguably become the most important programming language for developing ecommerce and other Web-driven applications. Its area of use is growing daily and includes dynamic Web-content generation with servlet technology, the building of business components with Enterprise JavaBeans, the creation of cross-platform user interfaces with Swing, and much more. Portable, distributed, multitier, object-oriented programs driven by the Web are the order of the day, and there is no language better than Java for writing these programs.
Let's take a look at a central component of the Java architecture, the Java Virtual Machine (JVM). The JVM is what gives Java its cross-platform functionality and many of its security and safety capabilities. The JVM is basically an abstract computer implemented in software. I'll focus mainly on its instruction set, which is called bytecode. Bytecode is an intermediate language between Java source and the target computer you want to run on. The following figure demonstrates how it works at a very high level.

From Java source to bytecode to host machine code
.java files (for example, MyClass.java)
.java files are compiled by the Java compiler into bytecode and stored in .class files (for example, MyClass.class)
.class files), performs some checks on it, and then converts it to the machine code of the target platform that executes it
This is where Java gets its platform independence. The bytecode format is the same on all platforms because it runs in the same abstract machine -- the JVM. As long as there is a JVM on any given platform, you can run Java on it. There's an old saying in computer programming, "You can solve any problem with another level of indirection." The JVM and bytecode together is another level of indirection.
Thanks!By Anonymous on January 24, 2010, 5:59 pmFirst, before the thanks, to the first commenter. Obviously you just wanted yourself to be heard, shush unless you want to be constructive. Nothing more annoying...
Reply | Read entire comment
5/10By Anonymous on January 21, 2010, 9:02 amunfortinly i already knew all this -.- but good for beginners
Reply | Read entire comment
ThanksBy Anonymous on January 1, 2010, 6:01 pmlook forward to your other articles it was very well done for basics
Reply | Read entire comment
Fantastic SiteBy Anonymous on January 1, 2010, 2:51 amI just stumbled across this site, and it has been perfect for me. After looking for hours on the Net and after thumbing through several 50 dollar books, all of...
Reply | Read entire comment
Simple and lucid.. Thanks Jacob...By Anonymous on December 27, 2009, 9:27 amSimple and lucid.. Thanks Jacob..
Reply | Read entire comment
View all comments