목록java (76)
gwooden_코린이

package 자바API; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Sample06 { public static void main(String[] args) { // 정규식 .compile(regex) Pattern p = Pattern.compile("b[a-z]*"); Matcher m; //검사할 데이터 (검사할 글자 입력) m = p.matcher("bat"); System.out.println(m.matches()); } } .compile("b[a-z]*") Pattern..compile("b[a-z]*") m = p.matcher("bat"); ("b[a-z]*") -> 첫 번째 자리는 무조건 b..

DecimalFormat - 숫자 형식 지정 package 자바API; import java.text.DecimalFormat; public class Sample05 { public static void main(String[] args) { // DecimalFormat - 숫자 형식 지정 // 천단위("#,###") DecimalFormat df = new DecimalFormat("#,###"); int a = 10000; System.out.println(df.format(a)); } } #은 부족한 부분은 표시 안함 DecimalFormat df = new DecimalFormat("0000"); int a = 11; System.out.println(df.format(a)); format

Aarrys 배열에 관련된 클래스들이 모여있는 곳 package 자바API; import java.util.Arrays; public class Sample03 { public static void main(String[] args) { String[] arr = {"홍", "이", "강", "김"}; Arrays.fill(arr, "임"); //fill 메서드를 이용해서 배열방에 있는 값을 모두 "임"으로 채운것 for(String a : arr) //반복문 이용해서 배열방 전부 "임"으로 교체 System.out.println(a); //후 출력 System.out.println(""); String[] arr1 = {"홍", "이", "강", "김"}; Arrays.fill(arr1, 1, 3, "..

Date 클래스 (날짜에 관련된 것들) 레거시 예전에 만들어 놓은 것들 유지 보수 할때는 해당 Date 클래스를 알고 있으면 좋지만 요즘에는 캘린더 클래스를 주로 사용한다. package 자바API; import java.util.Date; //Date 클래스 import 시 sql이 아닌 utill로 가져와야 된다. public class Sample01 { public static void main(String[] args) { Date now = new Date(); System.out.println(now); } } Date now = new Date();

- Wrapper int, double, char, long -> 객체로 만들어서 쓰고 싶을때 기본 타입래퍼 클래스 기본타입 래퍼 클래스 byte Byte short Short int Integer long Long float Float double Double char Character boolean Boolean 프린트문에는 기본 불리형(boolean)으로 값을 출력 package 자바API; public class Sample07 { public static void main(String[] args) { // Wrapper Integer i1 = new Integer(10); //박싱 Integer i2 = new Integer(10); System.out.println(i1 == i2); //객..

package 자바API; public class Sample06 { public static void main(String[] args) { double b = 5.45; System.out.println(Math.abs(-10)); System.out.println(Math.ceil(5.4)); System.out.println(Math.floor(5.8)); //반올림 System.out.println(Math.round(5.4)); System.out.println(Math.round(5.8)); System.out.println(Math.round(b * 10)/10.0); System.out.println(Math.max(5, 3)); System.out.println(Math.min(5, 3..

package 자바API; public class Sample05 { public static void main(String[] args) { long start = System.currentTimeMillis(); //현재 지금 시간을 알려준다 1/1000 StringBuffer sb = new StringBuffer() ; String str = ""; for(int i=0; i