전체 글66 [Java] 파일복사 import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; public class FileCopy { public static void main(String[] args) { String file_path = "원본파일경로"; String copy_path = "복사된 파일 경로"; try { FileInputStream input = new FileInputStream(new File(file_path)); FileOutputStream output = new FileOutputStream(n.. 2021. 10. 21. [Java] 자바 정규식 import java.util.regex.Matcher; import java.util.regex.Pattern; public class Regular_Expression { public static void main(String[] args) { boolean reg_ck = false; String txt = "안녕하세요~"; //String txt = "Hello World"; // 자바 정규식 String regExp = ".*[^a-zA-Z0-9$&+,:;=~?@#|'.^*()%!-|\\s]+.*";// 영어, 숫자, 키보드에 있는 특수문자 Pattern pattern = Pattern.compile(regExp); Matcher matcher = null; matcher = pattern.ma.. 2021. 10. 21. VO타입 list로 받기 package job; import java.util.List; public class FileVO { private List no; private List title; private List size; public List getNo() { return no; } public void setNo(List no) { this.no = no; } public List getTitle() { return title; } public void setTitle(List title) { this.title = title; } public List getSize() { return size; } public void setSize(List size) { this.size = size; } @Override publ.. 2020. 7. 14. txt파일 한줄씩 읽기 package job; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; public class File_read { public static void main(String[] args) { File file = new File("C:\\file_test\\test1.txt"); FileReader fr; String line = ""; try { fr = new FileReader(file); BufferedReader bfr = new BufferedReader(fr); while((line =.. 2020. 7. 14. java Singleton 사용하기 싱글톤 선언 및 싱글톤 메서드에 값 넣어주기 public class Method_Singleton { private static Method_Singleton instance; // 정적 필드, 인스턴스 생성 //private 생성자 private Method_Singleton() {} public static Method_Singleton getInstance(){ if(instance == null) { instance = new Method_Singleton(); } return instance; } // 값 넣어주기 public int num_singleton = 0; public String str_singleton = ""; public List list_singleton = new Array.. 2020. 5. 17. main Class에서 다른 Class 값 호출하기 값을 넣을 클래스와 메소드를 생성한다. public class Method_Test1 { // 숫자를 넣을 변수 public int number_1 = 0; // String 값을 넣을 변수 public String str = ""; // String 값을 넣을 List public List strList = new ArrayList(); //public으로 해야 호출이 가능함 public void methodTest() {// 각 각의 변수에 값을 담기 위해 method 생성 // int number_1 = 10; // str str = "str_TEST"; // List strList.add("list1"); strList.add("list2"); strList.add("list3"); } } //-.. 2020. 5. 17. 이전 1 2 3 4 5 6 ··· 11 다음