名称 | 做用 |
---|---|
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版)》学习指导]