Nero Swallowtail
Eternal Poster
- Joined
- Aug 13, 2020
- Posts
- 465
- Reaction
- 174
- Points
- 280
umay ,bat my error/exception sya? pano po ba to ayusin?
tapos kahit dun sa execution mali,kase ito po yung original txt file nya
pa help po sana, puro key word asa handout walang example ih HAHAHA
eto ung code.
tapos kahit dun sa execution mali,kase ito po yung original txt file nya
pa help po sana, puro key word asa handout walang example ih HAHAHA
eto ung code.
JavaScript:
import java.util.*;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
import java.nio.file.attribute.FileTime;
public class TaskPer6 {
static String files;
static Scanner scan = new Scanner(System.in);
public static void main(String[] args) throws IOException {
TaskPer6 Task = new TaskPer6();
Path file = Paths.get("C:\\Users\\Asta\\Documents\\Looping.txt");
/*
System.out.println(file.toString());
System.out.println(file.getName(3));
System.out.println(file.getFileName());
System.out.println(file.getNameCount());
for(int n = 0; n<= 3; n++) {
System.out.println("File Names are " + file.getName(n));
}*/
System.out.println();
File newFile = new File("C:\\Users\\Asta\\Documents\\TextFile.TXT");
Scanner scan = new Scanner(newFile);
String empty = "";
while(scan.hasNextLine()) {
System.out.println(scan.nextLine());
empty = empty.concat(scan.nextLine() + "\n");
}
FileWriter writer = new FileWriter("C:\\Users\\Asta\\Desktop\\Try5.txt");
writer.write(empty);
writer.close();
/*System.out.println(newFile.getName());
System.out.println(newFile.getAbsolutePath());
System.out.println(newFile.canRead());
System.out.println(newFile.canWrite());
*/
/*BasicFileAttributes fileAtt = Files.readAttributes(file, BasicFileAttributes.class );
long Size = fileAtt.size();
System.out.println("The File Size is " + Size);
FileTime time = fileAtt.creationTime();
System.out.println("File created at: " + time);
int time1 = file.compareTo(file);
System.out.println(time1);
FileTime time2 = fileAtt.lastModifiedTime();
System.out.println(time2);
System.out.println(newFile.createNewFile());
}
catch(IOException e) {
System.out.println("IO Exception");
}*/
}
public void absolute() {
System.out.println("\nPrompt");
files = scan.nextLine();
Path path = Paths.get(files);
Path newPath = path.toAbsolutePath();
System.out.println(files);
System.out.println("Hakdog " + newPath);
}
}
Attachments
-
You do not have permission to view the full content of this post. Log in or register now.