Java Myths- Fact versus Fiction

3:32 PM 1 Comments A+ a-

Inside Java :
Java myths - fact versus fiction

There are so many myths about Java. This month, I'll look at some of the more persistent ones, and try to dispel any doubt.

Fiction :
Applets can read your hard-drive, and delete files

Fact :
Any attempt by an applet to access local files will throw a SecurityException. If uncaught, the applet will crash, but no file access will occur.

The only exception to this rule is for digitally signed applets, which may be granted additional privileges. Your browser will display a dialog box, asking you if you want to accept the identity of the applet author. Choose no if unsure, and you'll always be safe.



Fiction :
Java requires a web browser. Java only runs in a web browser.

Fact :
Java code comes in many forms. The most familiar to users is the applet, which runs inside a web browser. However, this is only the tip of the iceberg.

Java applications can be run just like normal programs. By installing a JVM from vendors like Sun or Microsoft, you gain the ability to run Java programs. It's just like normal programs, such as Microsoft Word.

Java servlets run inside a web server. Servlets are a replacement for CGI scripts, and Active Server Pages (ASP). Servlets are actually really fast, and can be more efficient than CGI scripts.



Fiction :
Java is a hundred times slower than C, so you shouldn't ever use it for "serious" programming.

Fact :

The original Java Virtual Machines were slow, so slow that a comparable C application was about twenty times faster. The gap between C/C++ and Java is growing smaller though, thanks to better designed JVMs, and Just-In-Time (JIT) compilers that convert bytecode to native machine code at runtime.

Much of the cause for speed concerns is actually over applet loading - large applets take a long time to load initially. Thankfully, Java applications and servlets are not subject to such slow loading times. 



Fiction :
There's no point learning any language other than Java - it will dominate the software industry and put C++ programmers out of work.

Fact :
There are many languages suited to very narrow and specific tasks (such as artificial intelligence) that Java will never overcome. While it is true that Java has had phenomenal growth, and significantly eroded the role of C++, it still has a long way to go. Java excels in portability and Internet support - but C++ still offers better performance and the ability to interact with the operating system.



Fiction :
Applets are inherently unreliable. The differences between Netscape and Internet Explorer make it impossible to write stable applets.

Fact :
The problems with the behavior of applets running under browsers is due to the different JVMs - between browsers and browser versions. These differences can be frustrating for developers and users. There are often workarounds though, and applets should always be tested with a variety of browsers.

The optimal solution is to use a single JVM, which will be used across all browsers. Sound like fantasy? Sun Microsystems, the creators of Java, have come up with the Java Plug-in. The Java Plug-in bypasses the browser's JVM, and uses its own. This means that users with the plug-in installed can always rely on uniform performance, regardless of which browser they use. For more information, see the Java Plug-in page.

Currently working at Symantec in Chennai. Previously worked as a Senior Software Engineer at IGATE. Loves to explore new things, loves to code and solve challenging problems with the help of it. Like any other normal person, loves to watch movies, listen to songs (specially when travelling, it is must), getting to know people, travelling and whatever makes me feel good!