Java - Introduction to JAVA Question & Answer



Qus. What is a platform? How does it differ from a Java platform?

Ans. A platform is the hardware or software environment in which a program remains. The Java platform differs from most other platforms in that it’s a software only platform that runs on top of other hardware-based platforms.

Qus. What does the Robust feature in Java mean?

Ans. The term robust means strong or vigorous. Java uses some strong design measures to eliminate certain types of programming errors. It allows extensive compile-time error checking. Therefore most of the errors will be trapped and need to be rectified during compilation. 

Qus. State four features of Java.

Ans. Simple, Robust, Secured and Platform Independent.

Qus. What is Multithreading in Java?

Ans. Multithreading is a process of executing multiple threads simultaneously. Thread is basically a lightweight sub-process, a smallest unit of processing. The main purpose of multithreading in Java is to provide simultaneous execution of two or more parts of a program to utilize the CPU to the maximum.

Qus. Name two types of Java programs.

Ans. Application and Applet

Qus. State the difference between Applet and Application.

Ans. The fundamental difference between the two Java programs is that an application program is designed to run on a stand-alone machine whereas an applet is a web-version of an application which is used to run a program on a web browser.

Qus. Define the term Byte Code.

Ans. Java bytecode is the result of the compilation of a Java program, an intermediate representation of that program which is machine independent. The Java bytecode gets processed by the Java virtual machine (JVM) instead of the processor.

Qus. What is JVM? Explain its relationship with byte code.

Ans. The Java Virtual Machine (JVM) is the runtime engine of the Java Platform, which allows any program written in Java or other language compiled into Java bytecode to run on any computer that has a native JVM.

Qus. Explain the statement “Byte code is the object code for the JVM”.

Ans. Normally object code refers to a program in a form that the host system can run directly. As java source code is converted to bytecode during compilation which is then recognised by the JVM, Thus bytecode is sometimes referred to as the object code for the JVM.

Qus. What makes Java suitable to create secured applications?

Ans.  Java is designed to be secure in a networked environment. It is designed with multiple layers of security countermeasures embedded in the compiler, runtime system, and in browsers that support Java. These countermeasures make Java inherently more secure for developing any type of trusted application software. The Java run-time environment uses a byte code verification process to ensure that code loaded over the network does not violate Java security constraints.

Qus. What is Java API?

Ans. An application programming interface (API), in the context of Java, is a collection of prewritten packages, classes, and interfaces with their respective methods, fields and constructors.

Qus. What makes Java Architecture Neutral?

Ans. In Java there are no implementation dependent features. In most of other languages you need to know features that are hardware or OS dependent. For example in a high-level language called C the int data type occupies 2 bytes of memory for 32-bit architecture and 4 bytes of memory for 64-bit architecture. But in java, it occupies 4 bytes of memory for both 32 and 64 bit architectures.

Ans. What is WORA?

Ans. “Write once, run anywhere” (WORA), or sometimes write once, run everywhere (WORE), is a slogan created by Sun Microsystems to illustrate the cross-platform benefits of the Java language.