what is bytecode ?explain in detail and watz the difference
between bytecode and machine code?

Answers were Sorted based on User's Feedback



what is bytecode ?explain in detail and watz the difference between bytecode and machine code?..

Answer / ashwani

Actually java has the two main component.
1.Compiller.
2.Interpreter.

Thus byte codes are the codes which are generated by the
compiller by using our source code and this compilled code
or say the byte code is converted to the machine code or say
deployed by the interpreter.

Is This Answer Correct ?    29 Yes 2 No

what is bytecode ?explain in detail and watz the difference between bytecode and machine code?..

Answer / manoj

byte code ia a intermedaite code.byte code is converted to
machine code by jvm

Is This Answer Correct ?    26 Yes 3 No

what is bytecode ?explain in detail and watz the difference between bytecode and machine code?..

Answer / swati pundeer

bytecode is a intermediate code,which is platform
independent.thats why it run on different type
machines.this code does not depend on the hardware
architecture.
the difference between bytecode & machine code is that
bytecode formed by special characters,which is not
understandable by users.machine code is formed by binary
digits(1 or 0)form.which is hardware compatible.

Is This Answer Correct ?    14 Yes 5 No

what is bytecode ?explain in detail and watz the difference between bytecode and machine code?..

Answer / dheeraj shandilya

Byte code is a lower-level, platform-independent
representation of source code.Roughly, Python translates
each of source statements into a group of byte code
instructions by decomposing them into individual steps.
This byte code translation is performed to speed execution—
byte code can be run much more quickly than the original
source code statements in text file.
Machine code or machine language is a system of impartible
instructions executed directly by a computer's central
processing unit(cpu).
In case of bytecode in python we dont use cpu.

Is This Answer Correct ?    5 Yes 0 No

what is bytecode ?explain in detail and watz the difference between bytecode and machine code?..

Answer / suraj kumar

byte code is a intermidediate code.byte code is convertd to
machine code by java.the difference between byte code &
machine code is that byte code formed by special
characters,which is not under stande by usrrs.which is
hardware compatible.

Is This Answer Correct ?    3 Yes 0 No

what is bytecode ?explain in detail and watz the difference between bytecode and machine code?..

Answer / vishal singh

Bytecodes are the machine language of the Java virtual machine. When a JVM loads a class file, it gets one stream of bytecodes for each method in the class. The bytecodes streams are stored in the method area of the JVM. The bytecodes for a method are executed when that method is invoked during the course of running the program. They can be executed by intepretation, just-in-time compiling, or any other technique that was chosen by the designer of a particular JVM.

A method's bytecode stream is a sequence of instructions for the Java virtual machine. Each instruction consists of a one-byte opcode followed by zero or more operands. The opcode indicates the action to take. If more information is required before the JVM can take the action, that information is encoded into one or more operands that immediately follow the opcode.

Each type of opcode has a mnemonic. In the typical assembly language style, streams of Java bytecodes can be represented by their mnemonics followed by any operand values. For example, the following stream of bytecodes can be disassembled into mnemonics:

// Bytecode stream: 03 3b 84 00 01 1a 05 68 3b a7 ff f9
// Disassembly:
iconst_0 // 03
istore_0 // 3b
iinc 0, 1 // 84 00 01
iload_0 // 1a
iconst_2 // 05
imul // 68
istore_0 // 3b
goto -7 // a7 ff f9


The bytecode instruction set was designed to be compact. All instructions, except two that deal with table jumping, are aligned on byte boundaries. The total number of opcodes is small enough so that opcodes occupy only one byte. This helps minimize the size of class files that may be traveling across networks before being loaded by a JVM. It also helps keep the size of the JVM implementation small.

All computation in the JVM centers on the stack. Because the JVM has no registers for storing abitrary values, everything must be pushed onto the stack before it can be used in a calculation. Bytecode instructions therefore operate primarily on the stack. For example, in the above bytecode sequence a local variable is multiplied by two by first pushing the local variable onto the stack with the iload_0 instruction, then pushing two onto the stack with iconst_2. After both integers have been pushed onto the stack, the imul instruction effectively pops the two integers off the stack, multiplies them, and pushes the result back onto the stack. The result is popped off the top of the stack and stored back to the local variable by the istore_0 instruction. The JVM was designed as a stack-based machine rather than a register-based machine to facilitate efficient implementation on register-poor architectures such as the Intel 486.

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More Core Java Interview Questions

When is the finalize() called?

0 Answers  


List the different types of classloaders in java.

0 Answers  


In Inheritance if we are implementing Multi level inheritance and all class having same name of variable and now i want to access each class variable and how it is possible?

2 Answers  


Which is dependent variable?

0 Answers  


What is basic syntax?

0 Answers  






Is arraylist ordered in java?

0 Answers  


What is default constructors?

0 Answers  


What is the latest java version?

0 Answers  


How do you test a method for an exception using junit?

0 Answers  


What are unchecked exceptions in java?

0 Answers  


Is there a sort function in java?

0 Answers  


What is the main difference between java platform and other platforms?

0 Answers  


Categories