2007年9月28日 星期五

Homework 9/21/2007

1. Explain bytecode, JVM
bytecode is the machine language for JVM
2. Explain class, object
class is the name for a type whose values are objects.
object are entities that store data and 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

沒有留言: