2007年3月26日 星期一

3/26LAB


3/26上機考

4.
int 為整數 long 為長整數兩者都不會有小數點,在經過運算後 所呈現的答案皆會自動捨去小數點
而int是4位元long是8位元由於long是八位元所以 long的準確度比較高!
float與double則是支援小數點
當float與double在運算時 或者宣告輸入時 可以出現小數點後面的位數,它們之間的差別則在於一個是4位元一個是8位元 由於double是8位元 所以是兩倍準確


3.
C已經使用BF , 而JAVA是後來才出現 為不使使用者混淆, 以及引發程式碼相似度過高 ,
所以有些相同作用的程式指令 需以不同的文字來呈現 用以分隔兩者之間的差異!
所以JAVA使用BufferedReader






3/19 homework

1.project1

2.project3

3.project8



2007年3月18日 星期日

3/12 Homework

1. Do Display 1.7 of Chap. 1

2. Do Project 5 of Chap. 1


2007年3月12日 星期一

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



2007年3月5日 星期一