Java Programming 3-4: Basics of Input and Output Practice Activities Lesson Obje
ID: 3853124 • Letter: J
Question
Java Programming 3-4: Basics of Input and Output Practice Activities Lesson Objectives: Describe the basics of input and output in Java Read data from and write data to the console Vocabulary: Identify the vocabulary word for each definition below. The physical name of a file, or a symbolic link name. A type of node at the bottom of a top-down hierarchical (or inverted tree) that has no node below it. A file name that maps to another file. A top-down single node hierarchy. The top most node of a file system hierarchy, also known as a volume name, and used on the Linux operating system. The top most node of a file system hierarchy, also known as a volume name, and used on the Windows operating system. A hierarchy of elements, starting from a top-most (or root node) and moving down to nodes without any subordinate nodes. Either a relative path, which may be some nodes and then a file name, a file name, or an absolute path with a file name as the last element, or leaf node. This type of path starts with a logical mount, like C:l or D: in Windows, or a / (forward slash) or combination of a forward slash and one or more node name, as long as its qualified as a mount point A hierarchy where the top-most node is the root and the bottom-most nodes are leaf nodes A path that starts somewhere other than the root node and ends in a file name. The top most node of an absolute or relative path. A specialized file that points to another absolute or relative file name.Explanation / Answer
Here is the answer for the question. Please rate it if it helped. Thank you.
2)
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.Path;
public class FileSystemTest {
public static void main(String[] args) {
FileSystem fs = FileSystems.getDefault();
Path path = fs.getPath("C:\BlueJ\tempfiles\tempfiles.txt"); //use \ since is represents escape sequence
System.out.println(path);
}
}
=======
3)
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
public class ReadFile {
public static void main(String[] args) {
File f = new File("C:\BlueJ\tempfiles\tempfiles.txt");
try {
FileReader reader = new FileReader(f);
BufferedReader buffReader = new BufferedReader(reader);
String line ;
while((line = buffReader.readLine()) != null)
System.out.println(line);
buffReader.close();
} catch (FileNotFoundException e) {
System.out.println(e.getMessage());
} catch (IOException e) {
System.out.println("An error occured while reading the file.");
}
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.