why java is platform independent?

Answers were Sorted based on User's Feedback



why java is platform independent?..

Answer / dinesh haridoss

Java was designed to not only be cross-platform in source
form like C, but also in compiled binary form. Since this
is frankly impossible across processor architectures Java
is compiled to an intermediate form called byte-code. A
Java program never really executes natively on the host
machine. Rather a special native program called the Java
interpreter reads the byte code and executes the
corresponding native machine instructions. Thus to port
Java programs to a new platform all that is needed is to
port the interpreter and some of the library routines. Even
the compiler is written in Java. The byte codes are
precisely defined, and remain the same on all platforms.

The second important part of making Java cross-platform is
the elimination of undefined or architecture dependent
constructs. Integers are always four bytes long, and
floating point variables follow the IEEE 754 standard for
computer arithmetic exactly. You don't have to worry that
the meaning of an integer is going to change if you move
from a Pentium to a PowerPC. In Java everything is
guaranteed.

Is This Answer Correct ?    4 Yes 7 No

why java is platform independent?..

Answer / asha

java have java virtual machine which make java plateform
independent..jvm convert input source code into bye code
which is run on any plateform..

Is This Answer Correct ?    9 Yes 13 No

why java is platform independent?..

Answer / suresh

java is platform independent because the virtual machine
include all operating system,so java is run on any platform

java compiler converted source code into byte code,then the
jvm to translate the byte code into machine code

Is This Answer Correct ?    3 Yes 7 No

Post New Answer

More C Code Interview Questions

void main() { int k=ret(sizeof(float)); printf("\n here value is %d",++k); } int ret(int ret) { ret += 2.5; return(ret); }

1 Answers  


#define SQR(x) x * x main() { printf("%d", 225/SQR(15)); } a. 1 b. 225 c. 15 d. none of the above

3 Answers   HCL,


main() { float me = 1.1; double you = 1.1; if(me==you) printf("I love U"); else printf("I hate U"); }

1 Answers  


write a program to count the number the same (letter/character foreg: 's') in a given sentence.

2 Answers  


How to reverse a String without using C functions ?

33 Answers   Matrix, TCS, Wipro,






Write a program using one dimensional array to assign values and then display it on the screen. Use the formula a[i]=i*10 to assign value to an element.

1 Answers   Samar State University,


Is the following code legal? struct a { int x; struct a b; }

1 Answers  


Which version do you prefer of the following two, 1) printf(ā€œ%sā€,str); // or the more curt one 2) printf(str);

1 Answers  


abcdedcba abc cba ab ba a a

2 Answers  


main() { char * strA; char * strB = I am OK; memcpy( strA, strB, 6); } a. Runtime error. b. I am OK c. Compile error d. I am O

4 Answers   HCL,


1) int i=5; j=i++ + i++ + i++; printf("%d",j);This code gives the answer 15.But if we replace the value of the j then anser is different?why? 2)int i=5; printf("%d",i++ + i++ + i++); this givs 18.

8 Answers   IBPS, Infosys, TCS,


writte a c-programm to display smill paces

2 Answers  


Categories