FAQs in Core Java

[ Here u will find few frequently asked questions in Core Java Interviews and some related useful information. ]

Java -> History of Java
It is always a good practice to know a little bit of history and background of any technology before starting to actually use it. In fact Java has nothing to do
with the 'Island Java' in Indonesia. It all started at Sun Microsystems when they
were developing an application for the 'set-top box'. 
In 1990's they tried to develop a portable application that can run on any micro chip.
Not surprisingly, the team chose C++ to accomplish this task. But soon they found
that there are many features in C++ that prevented it from being PORTABLE.
 Therefore they tried to remove those features that are platform dependent. In doing so, they ended up developing a new programming language. They named this new programming language as OAK. Some say that the reason simply being that the team leader James Gosling spent most of the time under a OAK tree. So they chose this name. Surprisingly, this programming language never took off.
In 1995, the WWW (World Wide Web) became popular and Internet came to be widely used even among homes. This was a blessing in disguise for 'OAK'. The WWW presented 
the same problems and issues such as the 'set-top box' software. Around the globe, there were many different platforms, under different operating systems and therefore there was a need for a portable, platform independent programming language which can be used to write programs that can run on all these different platforms without the necessary of re-compilation.
Sun Microsystems, renamed OAK to 'JAVA' with some changes and launched it in the same year. Developers around the globe immediately found Java's potential and the WWW got its new look and Java took the world by storm.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Java -> What is Java?

A search on 'What is Java' in google returns roughly about 329,000,000 pages. That is the popularity of Java on the web. If you haven't read the history of Java please read it first here. Java was just meant to be a portable, platform independent programming language. But over the years it has transformed into a complex platform for computing portable software across different devices and systems.

What is the need for Java?

When there were so many programming languages already available what was the need for another programming language.
To understand this let us take an example of a program that runs on a SONY TV remote control. This program can  be written using a language (let us assume) called X. The remote control has an in-built chip on which this program will run. If we look at the functionality of a TV remote it is almost the same for any brand of TV. So by right the same program should be used on any brand of TV remote. 
In reality it is not. Why? Because the in-built chip in different brand of TV Remotes maybe different. Therefore the same program has to run these two different chips, they have to be re-compiled in order to suit different chips in other words platforms. If there are 100 different brands, the same program has to be re-compiled 100 times to suit these 100 different brands. This is where the problem arises. That is why a new programming language was needed. And Java was the answer. 

How does Java solve this problem?

The Java designers came out with a wonderful concept of a 'Java Virtual Machine'. Now Java differs from rest of the languages in using this unique concept. Which means unlike other languages a Java program when compiled produces a ByteCode rather than machine code. This ByteCode is machine independant (platform independant). The Java Virtual Machine resides on the machine and interprets this ByteCode into a form the machine can understand. 
Now take the same example of a TV remote. If the program was developed using Java rather than X, then the same program can be used in all different brand of TV Remotes provided all of them have the 'Java Virtual Machine' (JVM) installed on them. If all of them have the JVM the JVM will convert this same program into a form that each brand of TV remote understands. This is a very simple but effective method of making a program portable. This is how Java solves this problem.

No comments:

Post a Comment