2007年3月26日 星期一

java 考試 (一)

1. Revise your program for Simple Java Expression according to Java program styles. Check the following(1) the naming of constants, if any,(2) Java spelling conventions, and(3) indenting.




















2. Insert proper comments in your program for Simple Java Expression. Note that there are 2 ways to insert comments: line comments and block comments.









3. The identifier BufferedReader is normally abbreviated as BR in programming language C. However, Java programmers normally do not use abbreviations in identifiers. Can you give some good reasons for using long names in Java?








4. The Java Virtual Machine handles string objects in a way different from the one it handles variables of primitive types such as int, long, float, and double. What is the difference?





ans:





spring 在 java 裡面是個類別為 (class) 的變數





int-integer 整數的方式可記憶 4bytes





long-integer 整數的方式可記憶 8bytes





float 浮點數的方式可記憶 4bytes





double 浮點數的方式可記憶 8bytes

java 作業 (五)

project 1
































project 2































project 3

2007年3月12日 星期一

java 作業 (二)

Java Homework Problems 2007/3/5

1. Explain bytecode, JVMAns : 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.


Java
↓ compile
Byte-code
↓ interpreter
Microprocessor


JVM : A Java virtual machine or JVM is a virtual machine that runs Java byte code. This code is most often generated by Java language compilers, although the JVM has also been targeted by compilers of other languages.


2. Explain class, objectAns:

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. Object-oriented programming has its own specialized terminology. The objects are called, appropriately enough, objects. The actions that an object can take are called methods. Objects of the same kind are said to have the same type or, more often are said to be in the same class.

class(類別) → 1.Methods:(actions動作) 2.Property:(屬性 )

objects(物件)


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




2007年3月5日 星期一

2007年3月2日 星期五

聰明的我

決定把它分開

沒錯

下面可以連到網際網路

http://www.網際網路.com

阿恩阿恩

現在是另一堂課

不是JAVA

是網際網路

所以我還是會認真的 (說謊)