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.
Thank you so much! I was in an autotutorial intro to OOP class By Anonymous on June 10, 2009, 12:42 amThank you so much! I was in an autotutorial intro to OOP class last semester and chose to drop it because the examples and explanations they provided were poorly...
Reply | Read entire comment
AWESOMEBy Ace on May 29, 2009, 10:17 pmThis is AWE .... wait for it! ... SOME!! .... is the 2nd out yet?
Reply | Read entire comment
good postBy Anonymous on May 26, 2009, 12:42 pmgood and gr8
Reply | Read entire comment
You truly are a genius :)By Anonymous on May 15, 2009, 12:03 pmWow! That was helpful :) Thanks a lot! I wish the professors in the university could explain things the way you do. You give nice and easy examples, try not to use...
Reply | Read entire comment
awresome By Anonymous on May 10, 2009, 4:56 pmawresome
Reply | Read entire comment
View all comments