Skip to content

Instantly share code, notes, and snippets.

View dangnhdev's full-sized avatar

Nguyễn Hải Đăng dangnhdev

  • Hanoi, Vietnam
View GitHub Profile
import com.activestudy.Utility.file.FileUtils;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
/**
*
@dangnhdev
dangnhdev / TestASLib.java
Last active February 15, 2016 07:04
Test WatchDirService
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;
/**
*
//khởi động watch service
new Thread(watchService).start();
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;
/**
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardWatchEventKinds;
/**
*
* @author NguyenHaiDang
*/
Path newfile = FileSystems.getDefault().getPath("C:/rafaelnadal/tournaments/2010/SonyEricssonOpen.txt");
try {
Files.createFile(newfile);
} catch (IOException e) {
System.err.println(e);
}
Path newdir = FileSystems.getDefault().getPath("C:/rafaelnadal/tournaments/2010/");
try {
Files.createDirectory(newdir);
} catch (IOException e) {
System.err.println(e);
}
public class Person {
private int pid;
private String name;
public Person(int pid, String name) {
this.pid = pid;
this.name = name;
}
@Override
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));
}
}
#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++){