2007年3月11日 星期日







1. Explain bytecode, JVM

Ans :

byte-code : The programs are first translated into an small ,easy-to-write and inexpensive language .This is a intermediate language .Program translated this intermediate language into the machine language for a particular appliance or computer .This intermediate language is call Java byte-code or byte-code.


2. Explain class, object

Ans:

A Java program is divided into smaller parts called classes.Class is placed in a file of the same name,except that the ending is changed from .java to .class.So,when we compile a class named FirseProgram in the file FirstProgram.java,the resulting byte-code is stored in a file named FirstProgram.class.Call the translated low-level-language program that the compiler produces the object program.

4.1 Write a Java program as follows:

Let i=2;
Print i;
Print 2 * (i++);
Print i;
Ans: 2, 4, 3
4.2 Write a Java program as follows:
Let i=2;
Print i;
Print 2 * (++i);
Print i;
Ans: 2, 6, 3

4.3 Write a Java program as follows:

Let m=7, n=2;
Print (double) m/n;
Print m/ (double)n;
Ans: 3.5, 3.5



沒有留言: