본문 바로가기
728x90

비트 장기/JAVA33

7/19 복습(overriding, 다형성,상) 오버로딩 : 한 클래스 내에서 같은 이름의 메서드를 정의 ( 받는 매개변수가 다르다) 이해가 안될때 가장 쉬운방법은 예제를 보는것이다. ex )void calc( int a ){system.out.println(a);}void calc( int a , int b){system.out.println(a+b);}void calc( int a , string b){system.out.println(a,b);} 위와같이 메서드의 이름은 같으니 받는 매개변수의 개수나 타입이 다르면 오버로딩이다. 오버라이딩 : 상속받은 메서드의 내용을 변경 ( 메서드 이름과 매개변수는 같다) class mainC{void riding(int a){system.out.println(a);}}class subC extends main.. 2018. 7. 26.
7/24 복습 for each문 돌아가는거 알기String[] name = {"KIM","JACK","LEE","DACUYA"}; for( String Nm : name ) {System.out.println("name is "+Nm ); } 결과값name is KIMname is JACKname is LEEname is DACUYA LinkedList ctrl space get,add,remove,set 사용법과 결과 알기 1234567891011121314151617181920212223package pack; import java.util.LinkedList; public class Hello { public static void main(String[] args){ LinkedList li = new Linke.. 2018. 7. 25.
7/24 배움 //http://forest71.tistory.com/117 123456789101112131415161718192021222324252627282930313233343536373839404142package pack;import java.util.Iterator;import java.util.LinkedList;import java.util.Random;import java.util.Scanner;import javax.swing.plaf.SliderUI;//c create: add//r read: get//u update: set//d delete: remove+search//모든 데이터는 crud이다.public class Hello { public static void main(String[] a.. 2018. 7. 24.
7/23 (exception 예외처리 try catch) 123456789101112131415161718192021222324252627package pack;import java.util.Random;import java.util.Scanner;class Tiger{ String name; String address; int age; void func01() { System.out.println("호랑이"); }}public class Hello { /* public static void main(String[] args)throws Exception { //throws ex ctrl space Thread.sleep(1000); //exception이 떳을때 catch를 할 수 없다. 간단하게 쓰기용 //보통은 try catch를 자주씀 */ public.. 2018. 7. 23.