This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
Not very tricky at all, really, unless you want to get bogged down in minute details.
The Basic Story
Java programs run on one platform only: the Java Virtual Machine (JVM). By targetting the JVM, rather than the underlying Operating System (OS), Java is said to be independent of the OS platform.
The JVM is typically a program that runs on the native architecture of the OS. Therefore, the executables and libraries that make up the JVM are dependent on the OS platform.
Some of the Complications
The Java libraries (java.* packages) contain a few methods that are "native". These methods are typically implemented in C or C++ and come in libraries that are dependent on the OS platform.
Some Java applications need to access OS features that are not exposed by the Java libraries or JVM. They do this by implementing their own "native" methods through JNI. Again, this results in libraries that are dependent on the OS platform.
While the Java libraries make it possible for a careful programmer, writing in pure Java (no native code), to "abstract away" most platform differences, sometimes this is not 100% successful. Very occasionally, a pure Java program has to test what OS it is running on, via System.getProperty(). This should always be considered a last resort, done only after checking carefully that there is no other way.
If currently writing and running your Java code on only one platform, you should take care not to inadvertently hard-code features of that platform. For instance, if running on Windows, don't hard-code back-slashes into file paths etc.
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
thanks a lot for the deep explanation. I did read somewhere abt the way a JVM uses the Host Porting Interface(HPI) for making an abstraction layer from the target operating system is the reason for its dependence on the underlying platform.