This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.activestudy.Utility.file.FileUtils; | |
import java.io.IOException; | |
import java.nio.file.Path; | |
import java.nio.file.Paths; | |
import java.util.List; | |
/** | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.activestudy.Utility.file.watchservice.WatchDirService; | |
import com.activestudy.Utility.file.watchservice.WatchEventAction; | |
import java.io.IOException; | |
import java.nio.file.Path; | |
import java.nio.file.Paths; | |
import java.nio.file.StandardWatchEventKinds; | |
/** | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//khởi động watch service | |
new Thread(watchService).start(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.activestudy.Utility.file.watchservice; | |
import java.io.IOException; | |
import java.nio.file.*; | |
import java.util.*; | |
import static java.nio.file.StandardWatchEventKinds.*; | |
import java.nio.file.WatchEvent.Kind; | |
import java.nio.file.attribute.BasicFileAttributes; | |
/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.IOException; | |
import java.nio.file.Path; | |
import java.nio.file.Paths; | |
import java.nio.file.StandardWatchEventKinds; | |
/** | |
* | |
* @author NguyenHaiDang | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Path newfile = FileSystems.getDefault().getPath("C:/rafaelnadal/tournaments/2010/SonyEricssonOpen.txt"); | |
… | |
try { | |
Files.createFile(newfile); | |
} catch (IOException e) { | |
System.err.println(e); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Path newdir = FileSystems.getDefault().getPath("C:/rafaelnadal/tournaments/2010/"); | |
… | |
try { | |
Files.createDirectory(newdir); | |
} catch (IOException e) { | |
System.err.println(e); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Person { | |
private int pid; | |
private String name; | |
public Person(int pid, String name) { | |
this.pid = pid; | |
this.name = name; | |
} | |
@Override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Test { | |
public static void main(String[] args) { | |
Person p1 = new Person(0, "Person1"); | |
Person p2 = new Person(0, "Person2"); | |
System.out.println(p1.hashCode() == p2.hashCode()); | |
System.out.println(p2.equals(p1)); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<conio.h> | |
main() | |
{ | |
int n; | |
int tong=0; | |
printf("nhap vao so phan tu cua mang:"); | |
scanf("%d",&n); | |
int mang[n]; | |
for(int i =0; i<n; i++){ |