今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Managing files with Java 7's new I/O library
- In Java 7, a new IO library was introduced that greatly simplified a lot of common operations. You can only use this library in Java 7 and later and unfortunately, at least at this point, it has not been implemented for Android. So Android developers will still need to use those older classes. But I'll show you how to accomplish the same task I did earlier, copying a simple file. In this project, NewIO, I'm once again starting with the file named loremipsum.txt in a file subdirectory of the project. And this time, I'll be able to copy the file with far less code. I'll start in my Main method by creating two instances of a class named Path. The Path class is a member of the package java.nio.file and it needs to be imported. A Path object can point to either a directory or a file. In this case, it's going to point to my loremipsum.txt file. To get the reference to the file, I'll use another class named Paths. All of the…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。