名稱 | 做用 |
---|---|
Calendar | 設定時間日期等字段 |
add() | 改變Calendar的時間 |
roll() | 針對日期中某個字段加減 |
getDefault() | 取得默認時區信息 |
問題1解決方案:含義是取得不一樣詳細程度的時間。之因此會引發個人不解,是以前我對"格式化"的理解是「清空」「刪除」「初始化」。html
拓展:格式化(format)是指對磁盤或磁盤中的分區(partition)進行初始化的一種操做,這種操做一般會致使現有的磁盤或分區中全部的文件被清除。格式化一般分爲低級格式化和高級格式化。若是沒有特別指明,對硬盤的格式化一般是指高級格式化,而對軟盤的格式化則一般同時包括這二者。java
種類 | 說明 |
---|---|
低級格式化 | 對於部分硬盤製造廠商,它也被稱爲初始化。這個詞已經失去了本來的含義,大多數的硬盤製造商將低級格式化(Low-Level Formatting)定義爲建立硬盤扇區(sector)使硬盤具有存儲能力的操做。如今,人們對低級格式化存在必定的誤解,多數狀況下,說起低級格式化,每每是指硬盤的填零操做。軟盤的低級格式化一般是系統所內置支持的。一般狀況下,對軟盤的格式化操做即包含了低級格式化操做和高級格式化操做兩個部分。 |
高級格式化 | 高級格式化又稱邏輯格式化,它是指根據用戶選定的文件系統(如FAT十二、FAT1六、FAT3二、NTFS、EXT二、EXT3等),在磁盤的特定區域寫入特定數據,以達到初始化磁盤或磁盤分區、清除原磁盤或磁盤分區中全部文件的一個操做。 |
問題1:爲了檢驗BufferedRead,我將視頻中的代碼敲上去,出錯。git
視頻代碼1:express
問題1解決方案:調整步驟windows
誤將close() tab爲clone,修改後仍出錯。app
打名字時少打了er,故打bufferedReader時用Tab鍵時一樣補全時少了er。因此Tab需慎重。結果運行以下:
學習
問題2:視頻程序2
本身打的程序:ui
問題2解決方案:這個程序有兩個問題……和問題1是一個系列的問題,解決以後以下圖:
.net
乍一看輸出null略懵逼
其實就是輸出代碼位置的問題
線程
錯題1
下面哪條命令能夠把 f1.txt 複製爲 f2.txt ?錯題2
下面代碼中共有()個線程?
public class ThreadTest {
public static void main(String args[]){
MyThread myThread =new MyThread();
Thread t1=new Thread(myThread);
Thread t2=new Thread(myThread);
t1.start();
t2.start();
}
}
class MyThread extends Thread {
...
}
A .
1
B .
2
C .
3
D .
4
答案:C
錯題3
調用線程的interrupt()方法 ,會拋出()異常對象?
A .
IOException
B .
IllegalStateException
C .
RuntimeException
D .
InterruptedException
E .
SecurityException
答案:DE
-錯題4
現有:
3. import java.util.*;
4. class ForInTest {
5.static List list=new ArrayList();
6.
7.public static void main (String [] args) {
8.list. add("a"); list. add("b");list. add( "c");
9. //insert code here
10. System.out.print (o);
11. }
12. }
哪一行插入到第9行將致使輸出「abc"?
A .
for (Iterator o : list.iterator(); o.hasNext (); )
B .
for (Iterator o : list)
C .
for (Object o : list.iterator())
D .
for (Object o : list)
答案:D
解析:
錯題5
Given an instance of a Stream, s, and a Collection, c, which are valid ways of creating a parallel stream? (Choose all that apply.)
給定一個Stream的實例s, 一個Collection的實例c, 下面哪些選項能夠建立一個並行流?
A .
new ParallelStream(s)
B .
c.parallel()
C .
s.parallelStream()
D .
c.parallelStream()
E .
new ParallelStream(c)
F .
s.parallel()
答案:DF
解析:D,F.沒有ParallelStream等類,因此A和E是不正確的。流類中定義的方法來建立一個 parallel stream 從現有parallel(); ;所以C是正確的,F是不正確的。集合類中定義的方法來建立一個parallel stream 從收集parallelStream();所以D是正確的,B錯誤的。
錯題6
Which of the following statements about the Callable call() and Runnable run() methods are correct? (Choose all that apply.)
A .
Both can throw unchecked exceptions.
B .
Callable takes a generic method argument.
C .
Callable can throw a checked exception.
D .
Both can be implemented with lambda expressions.
E .
Runnable returns a generic type.
F .
Callable returns a generic type.
G .
Both methods return void
答案:A C D F
錯題7
What are some reasons to use a character stream, such as Reader/Writer, over a byte stream, such as InputStream/OutputStream? (Choose all that apply.)
A .
More convenient code syntax when working with String data
B .
Improved performance
C .
Automatic character encoding
D .
Built-in serialization and deserialization
E .
Character streams are high-level streams
F .
Multi-threading support
答案:AC
錯題8
Assuming zoo-data.txt is a multiline text file, what is true of the following method?
private void echo() throws IOException {
try (FileReader fileReader = new FileReader("zoo-data.txt");
BufferedReader bufferedReader = new BufferedReader(fileReader)) {
System.out.println(bufferedReader.readLine());
}
}
A .
It prints the first line of the file to the console.
B .
It prints the entire contents of the file.
C .
The code does not compile because the reader is not closed.
D .
The code does compile, but the reader is not closed.
E .
The code does not compile for another reason.
答案:A
解析:這段代碼編譯和運行沒有問題,因此C和E是不正確的。它使用一個來try-with- resource打開FileReader和BufferedReader對象。所以,自動關閉,D是不正確的。的主體try塊讀入文件的第一行和輸出給用戶。所以,A是正確的。由於其他的文件不讀,B是不正確的。
錯題9
Assuming / is the root directory, which of the following are true statements? (Choose all that apply.)
A .
/home/parrot is an absolute path.
B .
/home/parrot is a directory.
C .
/home/parrot is a relative path.
D .
The path pointed to from a File object must exist.
E .
The parent of the path pointed to by a File object must exist.
答案:A
解析:路徑,從根目錄開始是絕對路徑,所以是正確的和C是不正確的。B是不正確的,由於路徑能夠是一個文件系統中的文件或目錄。一個文件對象能夠引用一個文件系統路徑不存在,因此D和E是不正確的。
錯題10
What is the result of executing the following code? (Choose all that apply.)
String line;
Console c = System.console();
Writer w = c.writer();
if ((line = c.readLine()) != null)
w.append(line);
w.flush();
A .
The code runs without error but prints nothing.
B .
The code prints what was entered by the user.
C .
An ArrayIndexOutOfBoundsException might be thrown.
D .
A NullPointerException might be thrown.
E .
An IOException might be thrown.
F .
The code does not compile.
答案:BDE
解析:這是正確的代碼從控制檯讀取一行,並編寫到控制檯,使選項B正確的。選擇D和E也是正確的。若是沒有共同惟一可用,會拋出NullPointerException。append()方法拋出anIOException。
Which of the following are true? (Choose all that apply.)
A .
A new Console object is created every time System.console() is called.
B .
Console can only be used for reading input and not writing output.
C .
Console is obtained using the singleton pattern.
D .
When getting a Console object, it might be null.
E .
When getting a Console object, it will never be null.
答案:CD
解析:一個控制檯JVM建立對象。由於只有一個存在,它是一個單例,mak - ing選項C正確的。若是程序運行的環境中沒有一個控制檯,系統。控制檯()返回null,D也正確。其餘報表控制檯是不正確的。
Suppose that the file c:\book\java exists. Which of the following lines of code creates an object that represents the file? (Choose all that apply.)
A .
new File("c:\book\java");
B .
new File("c:\book\java");
C .
new File("c:/book/java");
D .
new File("c://book//java");
E .
None of the above
答案:BC
解析:選項B是正確的,由於Java須要一個反斜槓是與另外一個反斜槓轉義。選項C也是正確的,由於Java斜槓轉換爲正確的在處理路徑。
Which of the following are built-in streams in Java? (Choose all that apply.)
A .
System.err
B .
System.error
C .
System.in
D .
System.input
E .
System.out
F .
System.output
答案:ACE
教材學習中的問題和解決過程, 一個問題加1分
代碼調試中的問題和解決過程, 一個問題加1分
基於評分標準,我給本博客打分:XX分。得分狀況以下:xxx
- 結對學習內容 - 雖然我倆的實驗不同,可是仍有不明之處能夠討論,相互學習,完成實驗。
這本書快學完了,但是內心以爲很不踏實,準備使用從老師博客裏的java基礎視頻教程學習。老師發的視頻資料都很是棒,點贊。
代碼行數(新增/累積) | 博客量(新增/累積) | 學習時間(新增/累積) | 重要成長 | |
---|---|---|---|---|
目標 | 5000行 | 16篇 | 400小時 | |
第一週 | 9/9 | 1/1 | 19/19 | 熟練下載安裝技能,鍛鍊解決問題能力 |
第二週 | 185/194 | 1/2 | 16/35 | 下載並熟悉IDEA,練習使用碼雲、git的技能。 |
第三週 | 488/535 | 1/3 | 18/53 | 花了更少時間磨合軟件,學習更順利 |
第四周 | 366/901 | 2/5 | 18/71 | 繼承、多態、行爲 |
第五週 | 611/1512 | 1/6 | 14/67 | 異常處理、Collection與Map |
第六週 | 337/1849 | 1/7 | 16/73 | 輸入與輸出、線程與並行API |
第七週 | 459/2308 | 2/9 | 15/88 | Lambda、時間與日期 |
嘗試一下記錄「計劃學習時間」和「實際學習時間」,到期末看看能不能改進本身的計劃能力。這個工做學習中很重要,也頗有用。
耗時估計的公式
:Y=X+X/N ,Y=X-X/N,訓練次數多了,X、Y就接近了。
計劃學習時間:17小時
實際學習時間:15小時
改進狀況:大概是由於這一章簡單點,看書的速度快了點。
(有空多看看現代軟件工程 課件
軟件工程師能力自我評價表)
[《Java學習筆記(第8版)》學習指導]