1、 資料庫中使用update修改多個欄位值的問題
經我在PL/SQL環境下除錯,得出如下結論(scott/tiger 下的dept表):
update dept set dname='yao', loc='shaoyang' where deptno=10; --通過
update dept set(dname, loc)=('yao','shaoyang') where deptno=10; --錯誤
update dept set(dname, loc)=(select dname,loc from dept where deptno=20) where deptno=10;--通過
2、程式流程問題(題目略去, 如下為我的驗證程式碼):
public class TestCircle {
public static void main(String[] args) {
int i=2, j=9;
do{
if(i>j){
break;
}
j--;
}while(++i<5);
tln("i is: "+i+", j is: "+j);
int k = new TestCircle()Case(1);
tln("k is : "+k);
}
public int testCase(int n){
int j=1;
switch (n) {
case 1: j++;
case 2: j++;
case 3: j++;
case 4: j++;
case 5: j++;
tln("j is : "+j);
default: j++;
}
return n+j;
}
}
testCase這個問題我做錯了, 題目是要求最終打印出的k為8,請你給i與n賦值。
我在考場上寫的n=5, i=2; 執行得出結果卻為9. 分析了一下得出原因在於: 如果n<5的話,那麼它會從其自身起一直到5都會執行j++這條語句, 因為此程式碼片段中並沒有使用 break。
n與i有多種組合值, 如(1,1)、(4,1)和(5,1)等都可以。
4、 複習 JAVA的 “反射”章節。
5、 溫習 作業系統 部分的知識。
6、 陣列問題:
如我宣告 int [] a = new int[1] , 那麼a[0]的預設值就為0。 我起初理解錯誤了, 我認為如此宣告只是為陣列開闢了空間而已, 在其空間上預設值為NULL。
7、 關於啟動 gc 的方法:
() 和 RunTime()類的 gc() 方法, 但是即使呼叫了前面的方法也不保證一定會進行回收。
拓展之:
a. GC並不是定期來回收你的垃圾記憶體,即是根據需要來回收。
b. GC的`回收是因為:它認為你的系統已經開始記憶體緊張(這個就是jvm的神奇)
c. 即使GC開始準備清理你的垃圾記憶體,但是如果該記憶體的引用還存在(不等於null), 這個時候GC仍然無能為力!
d、 RunTime類的 public static Runtime getRuntime() 返回: 與當前 Java 應用程式相關的 Runtime 物件。
8、 int i=10, double e = 10.0; 判斷(i==e)、 (i==10.0)的真假。
我認為一個是int型別,一個是double型別,它們分屬不同的型別, 所以我認為其是錯誤的, 然而經執行測試發現是正確的。
9、 public static void main(String[] args){
StringBuffer str1 = new StringBuffer("a");
StringBuffer str2 = new StringBuffer("b");
conver(str1, str2); }