일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 버전일치
- sub query
- Spring
- 안드로이드
- 게시판
- React
- 왕초보
- git
- 오버라이드
- snowpack
- 시큐어코딩
- SQL
- FIle
- 숫자
- 스타일보험
- 코틀린
- java#왕초보
- 미니게임
- 답글
- 상속
- Android
- 함수
- 쿠키
- degit
- kotlin
- webpack
- 스프링
- parcel
- java
- Spinner
- Today
- Total
목록Coding (130)
YSHUSH

public class MainClass { public static void main(String[] args) { Sorting sort = new Sorting(); sort.input(); sort.sorting(); sort.result(); } } public class Sorting { int number[];// 멤버변수 int updown;// 멤버변수: 이 클래스 내의 모든 부분에 접근이 가능함 void input() { Scanner sc = new Scanner(System.in); System.out.print("몇개 정렬 = "); int count = sc.nextInt(); number = new int[count]; for (int i = 0; i < number.lengt..

public class MainClass { public static void main(String[] args) { String Member[][] = { {"모니카", "24", "123-4567", "서울시", "동창"}, {"노지혜", "19", "234-5678", "남원시", "찐친"}, {"립제이", "22", "345-6789", "인천시", "후배"} }; // 종이를 3장 준비 MemberDto member[] = new MemberDto[3];//MemberDto member1, member2, member3 -> 배열만 준비 // 기입할 수 있도록 준비 for (int i = 0; i < member.length; i++) { member[i] = new MemberDto(); } ..

public class MainClass { public static void main(String[] args) { MyClass cls = new MyClass(); //cls.number = 1; cls.name = "홍길동"; //cls.height = 171.1; cls.setNumber(123); int num = cls.getNumber(); System.out.println(num); } } public class MyClass { /* Encapsulation == 은닉성, 캡슐화 멤버에 대해서 외부 접근 제어(차단, 읽기전용, 허용여부) 접근 지정자 1. private : 개인적인 2. public : 대중적인 3. protected : 상속에 따른 보호// 요즘엔 잘 안씀 */ pri..

public class MainClass { public static void main(String[] args) { Student s = new Student(); s.name = "홍길동"; s.ban = 1; s.no = 1; s.kor = 100; s.eng = 60; s.math = 76; System.out.println("이름:"+s.name); System.out.println("총점:"+s.getTotal(s.kor, s.eng, s.math) ); System.out.println("평균:"+s.getAverage( ) ); } } class Student { String name; int ban; int no; int kor, eng, math; ---------------------..

˙ constructor : 생성자 객체 생성시에 호출. 메소드 클래스 명과 같다 return 값이 없다 overload가 가능하다 생략이 가능하다 별도의 호출이 불가능하다.(여러번 호출 불가) 첫번째값(초기값)을 집어넣기 위해 쓴다** ˙destructor : 소멸자 클래스 내에서 불가능한 형태 //MyClass cls = new MyClass(); //MyClass cls= new MyClass( 1 ); MyClass cls= new MyClass(2, "hello"); System.out.println(cls);// 현재 저장된 heap영역의 주소가 출력! //cls.MyClass(); -> 다시 별도의 호출이 불가 MyClass t = cls.getThis(); System.out.println..

구조, 관리 Object Oriented Programing 객체지향 흐름 ->절차지향 1. 은닉성(캡슐화) -> 요즘은 사라지는 추세 2. 상속성 3. 다형성 형식: class 클래스명 { variable(변수) method(함수) } // class, array -> allocation(동적 할당) -> Heap 영역에 저장 MyClass cls = new MyClass(); // 자료형 클래스의 변수 == 객체, object, // instance(주체) cls.number = 1;// cls, number = stack에 넘어가고 MyClass는 heap영역에 들어감 cls.name = "홍길동"; cls.method(); MyClass cls1 = new MyClass(); cls1.number..

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..