2007年9月21日 星期五

Homework 9/21/2007

1. Explain bytecode, JVM

bytecode:
bytecode also called intermediate code,this code could be the same to all appliances or all computers,and we can use a small,easy-to-write,and inexpensive program to translate this code to machine code,so we can easily change to machine code to operate those cpu or something.


JVM(Java Virtual Machine):
In the following question,we know what bytecode is.The bytecode just like a machine language of Java Virtual Machine.So we can use JVM to run the program we write in bytecode.


2. Explain class, object

class:
class is the name for a type whose values are objects.Many object to organize class.Those object also some data.This data has their attributes and can do actions to those data.


object:
object are entities that store data and can take actions.Object can take actions.



3. Reading Assignments:
Read 1.1, 1.2, 1.3 of Textbook
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

沒有留言: