System.out.println("1 big bad wolf\t8 the 3 little pigs\n4 dinner\r2night");
答案:2。\r是回車,回到當前行行首。html
A . Every variable must have an associated type before you can use it (在使用變量以前,每一個變量必定都有一個與之關聯的類型)
B . Variables can be used without declaring their type (變量能夠在不聲明其類型的狀況下使用)
C . Every variable has a single type associated with it throughout its existence in the program, and the variable can only store values of that type (在程序中,每一個變量都有一個與之關聯的類型,而變量只能存儲該類型的值)
D . Variables are allowed to change type during their existence in the program as long as the value it currently stores is of the type it is currently declared to be (變量存在於程序中時容許改變類型,只要它當前存儲的值是當前聲明的類型)
E . Variables are allowed to change types during their existence in the program but only if the change is to a narrower type (變量存在於程序中時容許改變類型,但只能縮窄轉換)
答案:C。定義變量時必須聲明類型。java
A . if (x > 0) x++;git
else x--;
B . if (x > 0) x++;vim
else if (x < 0) x--;
C . if (x > 0) x++;數據結構
if (x < 0) x--;app
else x = 0;
D . if (x == 0) x = 0;dom
else x++;ide
x--;函數
答案:B。題目說的若是是0就不操做,而C作了操做。學習
A . A syntax error may be generated by the compiler
B . A runtime error may occur during execution
C . A "garbage" or "uninitialized" value will be used in the computation
D . A value of zero is used if a variable has not been initialized
E . Answers A and B are correct
答案:E。按照題目的意思,出現編譯錯誤也能夠運行。
Random gen = new Random( );
A . gen.nextFloat( ) * 5
B . gen.nextFloat( ) * 10 - 5
C . gen.nextFloat( ) * 5 - 10
D . gen.nextInt( ) * 10 - 5
E . gen.nextInt(10) - 5
答案:B。看錯。
A . compares two string in a case-independent manner
B . yields true or false
C . yields 0 if the two strings are identical
D . returns 1 if the first string comes lexically before the second string
E . none of the above
答案:C。沒看懂identical的意思。
a) String string = new String("123.45");
b) String string = "" + 123.45;
A . true
B . false
答案:A。能夠用雙引號提示程序是一個字符串,而後用加號對字符串鏈接。
A . true
B . false
答案:B。聲明範圍太廣了,只能聲明倒數第二級的。
代碼行數(新增/累積) | 博客量(新增/累積) | 學習時間(新增/累積) | 重要成長 | |
---|---|---|---|---|
目標 | 10000行 | 30篇 | 400小時 | |
第一週 | 138/138 | 2/2 | 25/25 | 學會寫和上傳代碼,會編簡單的輸出程序 |
第二週 | 118/256 | 1/3 | 30/55 | 起文件名不能太長 |
第三週 | 868/1124 | 2/5 | 35/90 | Java類裏面的方法和C語言的函數很像 |