일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
- sub query
- 안드로이드
- webpack
- degit
- 왕초보
- 오버라이드
- Android
- React
- 쿠키
- Spinner
- FIle
- git
- SQL
- snowpack
- 버전일치
- 답글
- 함수
- java#왕초보
- 게시판
- 미니게임
- java
- kotlin
- parcel
- Spring
- 코틀린
- 스프링
- 상속
- 숫자
- 스타일보험
- 시큐어코딩
- Today
- Total
목록java (29)
YSHUSH

File file = new File("d:\\myfile\\writeData.txt"); try { // 쓰기 /* FileWriter fw = new FileWriter(file); fw.write("안녕하세요"); fw.write("hi hello"); fw.close();// -> read시에는 중요하지 않지만 write할때는 중요! 꼭있어야함! */ //추가쓰기 /* FileWriter fw = new FileWriter(file, true); fw.write("반갑습니다."); fw.close(); */ // 문장쓰기 FileWriter fw = new FileWriter(file); BufferedWriter bw = new BufferedWriter(fw); PrintWriter pw = ..

File file = new File("d:\\myfile\\newfile.txt"); FileReader fr; // 파일 읽기 try { // 한글자씩 읽기 /* fr = new FileReader(file); int ch = fr.read(); while(ch != -1) {// 한글자씩 읽었다가 [(-1) = 데이터가 없을때까지] 읽어라 System.out.println((char)ch); ch = fr.read(); } fr.close(); */ // 문장으로 읽기 /* FileReader fr = new FileReader(file); BufferedReader br = new BufferedReader(fr); String str; while((str = br.readLine()) != nu..

˙ IO == Input & Output의 약자 File : 저장 매체 Database(file) - 데이터베이스도 파일입출력이다. // 파일? 폴더? 조사 /* File filelist[] = file.listFiles(); for (int i = 0; i < filelist.length; i++) { if(filelist[i].isFile()) {// if(filelist[i].isFile() == true) 원래는 이런식으로 써야됨 System.out.println("[파일]" + filelist[i].getName()); } else if(filelist[i].isDirectory()) {// Directory == 폴더 System.out.println("[폴더]" + filelist[i].ge..

˙ Exception : 예외 != 에러 int number char array -> 범위초과 [5] -> 0 ~ 4 :: [5] class -> 없음 file -> 없음 (그 위치에없는 것 - 외부적인 요인) 형식 try { 예외가 발생될 가능성이 있는 코드 } catch ( 예외클래스1 e ) {

˙ Over Load : 함수 명은 같고 매개변수(parameter)의 자료형이나 갯수가 다른 것을 의미. 쉽게 말하면 '동명이인' 예) paint() : image drawing paint(int x, int y) paint(int z) paint(char c) paint(char c, int i) void paint(int i, char c) 적용X의 예) void paint(int n, char ch) X int paint(int i, char c) X public class MainClass { public static void main(String[] args) { method(); method('A'); method(10); method('B', 12); method(14, 'C'); int ..

˙ function : 함수. 독립적 ˙ method : class에 소속된 함수. ˙ 형식: parameter = 인수, 인자, 게타(getter) 돌아오는 값의 자료형 함수명(들어가는 값의 자료형 변수, 들어가는 값의 자료형 변수, ...) { 처리 return 값;// return value } void -> 자료형이 없는 것 int i = functionName('A');// 'A' == argument System.out.println(i); String st = "abcDEF"; String upst = toUpperCase(st); System.out.println(upst); functionName1(); functionName2(6.2, 0); int r = functionName3();..

#1. 변수의 문자가 숫자로만 되어 있는지 아니면 다른 문자인지를 판별하라 // 1. 변수의 문자가 숫자로만 되어 있는지 아니면 다른 문자인지를 판별하는 코드 // 예를 들어 char str = "A"; 일때 char c = 'A'; System.out.println((int)c); // 아스키코드 변환(int) int asccode = (int)c; boolean numberOK = true; if(asccode 57) { numberOK = false; } //숫자입니다 if(numberOK) { System.out.println("숫자입니다"); } //숫자가 아닙니다. else { System.out.println("숫자가 아닙니다"); } #2. 입력된 문자열이 ..

/* String : Wrapper class char[] 문자열을 편집, 정보취득 등등 */ String str; // String : class 명칭 // str : class 변수 == object(객체) str = "안녕하세요"; System.out.println(str); String str1 = new String("안녕하세요"); String str2 = "반갑습니다.";//1과 2는 동일한 과정 // 문자의 결합 String str3 = str1 + str2; System.out.println(str3); str3 = str3 + "건강하세요"; System.out.println(str3); // equals : 문자열을 비교 String str4 = "world"; String str5 ..

˙ Wrapper Class란? 일반 자료형(char, int, double)을 사용하기 편리하도록 구현해 놓은 것 "문자열" '가' '나' '다' 'h' 'e' 'l' 'l' 'o' -> 하나의 문자들을 모은 것 String: 원래는 자료형이 아님 -> Wrapper Class :도구상자라고 생각하면 됨 char chArr[] = { 'h' 'e' 'l' 'l' 'o' }; /* 일반 자료형 Wrapper Class(object) ------------------------------------------------ booleanBoolean byteByte shortShort intInteger------ longLong floatFloat doubleDouble------ charCharacter ..