일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Kotlin
- TypeScript
- SpringBoot
- RecyclerView
- 스프링부트
- JavaScript
- 오버라이딩
- Linux
- GoogleMaps
- Java
- scrollview
- 리액트
- stylesheet
- array
- TextView
- nodejs
- button
- fragment
- 안드로이드
- 자바스크립트
- Android
- 구글맵스
- 코틀린
- Hook
- 랜덤번호
- Javscript
- React
- 랜덤넘버
- JS
- npm
- Today
- Total
목록코딩 기록/Java (36)
타닥타닥 개발자의 일상
temp를 기억하자 package study0124_2; public class Main { public static void main(String[] args) { int[] question1 = {10,20}; System.out.println(question1[0]+" "+question1[1]); swap(question1); System.out.println(question1[0]+" "+question1[1]); } public static void swap(int []A) { int temp = 0; temp = A[0]; // temp에 A[0] 값을 집어넣는다 A[0] = A[1]; // A[0]에 A[1] 값을 집어넣는다. A[1] = temp;// A[1]에 temp값(=A[0]값)을..
StudentDto StudentDao package dto; public class StudentDto { private int number; private String name; private double height; private int eng; private int math; public StudentDto() { } public StudentDto(int number, String name, double height, int eng, int math) { super(); this.number = number; this.name = name; this.height = height; this.eng = eng; this.math = math; } public int getNumber() { ret..
private : 개인적인 public : 대중적인 protected : 상속에 따른 보호 MainClass MyClass package main; import mycls.MyClass; public class MainClass { public static void main(String[] args) { MyClass cls =new MyClass(); // cls.number =1; private이라 불가능 cls.name ="홍길동"; //public이라서 가능 //cls.height ="171.1"; protected 라서 불가능 cls.setNumber(123); //MyClass의 멤버변수 int number에 대입 int num =cls.getNumber(); //int num에 MyClass..
OOP ( Object Oriented Programing ) 프로그램의 구조, 관리때 쓰이는 기법 객체 지향 프로그래밍 특징 1. 은닉성(캡슐화) 2. 상속성 3. 다형성 형식: class 명 { variable method } public class OOP { public static void main(String[] args) { MyClass cls = new MyClass(); cls.method(); cls.number =1; cls.name = "홍길동"; MyClass cls1 = new MyClass(); cls1.number =2; cls1.name ="성춘향"; cls1.method(); TV tv1=new TV(); tv1.isPowerOn=true; tv1.channel=23; t..
import java.util.Arrays; import java.util.Scanner; 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.length; i++) { System.out.print((i+1)+"번째 수 = "); number[i] = sc.nextInt(); } System.out.println("오름(1)/내림(2) ="); updown =sc.nextInt(); } vo..
class Exercise1 { 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( ) ); } } [실행결과] 이름:홍길동 총점:236 평균:78.7 class Student { /* (1) 알맞은 코드를 넣어 완성하시오. */ } public class Studen..
// 학생들의 정보를 2차원배열에 입력을 받는다 (이름, 생년월일, 국어, 영어, 수학) //2차원 배열을 이용하여 학생들 개개인의 국영수 총점, 학생들의 국어 점수 총점, 학생들의 등수를 출력하라 import java.util.Arrays; import java.util.Scanner; public class StudentA { public static void main(String[] args) { String student[][] = { // 국어 영어 수학 { "홍길동", "1999-01-23", "100", "90", "75" }, { "성춘향", "2010-07-04", "90", "100", "95" }, { "일지매", "2001-03-05", "85", "95", "100" }, }; i..
package fileWork; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.Arrays; public class MainClass { public static void main(String[] args) { // String 에 있는 변수 3개 파일로 저장하고 저장된 파일 불러와서 배열로 저장한 다음 출력하기 ..
1.파일 생성하고 글쓰기 import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; public class MainClass { public static void main(String[] args) { File file = new File("c:\\myfile\\writeData.txt"); //file 은 c드라이브 my filee에 있는 writeData 텍스트 파일을 생성 파일이 없으면 만들어 버리거나 있는 파일을 덧씌워버린다. 따라서 쓰기전에 파일 존재부터확인 try { FileWriter fw = new FileWr..