• More than 1000 Questions
  • Short Tests for revision
  • New Questions added Daily
  • Search by Topic, Level, Frequency & Company
  • Actively Moderated by experienced developers

Search Java Interview Questions

Best Java Question Repository on web. Click Here

Java - Interview Questions and Answers on Portability

Q1. What is software Portability ?

Ans. Portability is the usability of the same software in different environments.

Q2. Is Java a portable language ?

Ans. Yes. 

Q3. What makes Java a portable language ?

Ans. Its Byte Code. Ability of the JVM to generate system specific binary code using intermediatery code ( class files).   

Q4.  What are advantages of using Servlets over CGI ?

Ans.  Servlets are portable as they are written in Java.

Q5.  What is Java bytecode ?

Ans. Java bytecode is the instruction set of the Java virtual machine. Each bytecode is composed by one, or two bytes that represent the instruction, along with zero or more bytes for passing parameters.

Q6.  Is JVM a overhead ? 

Ans. Yes and No. JVM is an extra layer that translates Byte Code into Machine Code. So Comparing to languages like C, Java provides an additional layer of translating the Source Code.

C++ Compiler - Source Code --> Machine Code
Java Compiler - Source Code --> Byte Code   ,  JVM - Byte Code --> Machine Code

Though it looks like an overhead but this additional translation allows Java to run Apps on all platforms as JVM provides the translation to the Machine code as per the underlying Operating System. 

Q7.  What is Byte Code ? Why Java's intermediary Code is called Byte Code ?

Ans. Bytecode is a highly optimized set of instructions designed to be executed by the Java run-time system. Its called Byte Code because each instruction is of 1-2 bytes.

Sample instructions in Byte Code -

1: istore_1
2: iload_1
3: sipush 1000
6: if_icmpge 44
9: iconst_2
10: istore_2

Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner
comments powered by Disqus