2008年9月25日 星期四

homework1

1. Explain bytecode, JVM

The java compiler translates your program into a language called byte-code,which is the machine language for a fictitious computer.It is easy to translate this byte-code into the machine language of any particular computer.Each type of computer will have its own interpreter that translates and executes byte-code instructions.Byte-code is the machine language for a fictitious computer called the Java Virtual Machine.

Byte-code is the machine language for a fictitious computer called the Java Virtual Machine.
2. Explain class, object
A java program works by having things called objects perform actions. The actions are known as methods and typically involve data contained in the objects. All objects of the same kind are said to be of the same class .
A class is a category of objects.

class 是類別.object 是特性

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;





4.2 Write a Java program as follows:
Let i=2;
Print i;
Print 2 * (++i);
Print i;





4.3 Write a Java program as follows:
Let m=7, n=2;
Print (double) m/n;

Print m/ (double)n;


沒有留言: