1. Explain bytecode, JVM
Byte-Code:將所寫的程式轉換成機械語言。
JVM:Java Virtual Machine,that is a Java byte-code interpreter.
2. Explain class, object
Class是用來描述屬性(Property)跟方法(Method),class要宣告成物件才能 呼叫Method, Object包含屬性(Property)和方法(Method),object可以直接 呼叫其方法,不需要宣告即可。
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
沒有留言:
張貼留言