본문 바로가기
몰입형학습

[JAVA] 배열정리+ String 객체이해

by jackypark 2022. 6. 23.

array(배열) : 동일한 DataType을 메모리상에 순차적으로 확보한다.

장점-> 일괄처리 가능

배열들을 그림으로 나타내봤다.

int []arr=new int[4];

1차원 배열

int arr2[][]=new int[2][2];

2차원배열

int arr3=new int[2][3][2];

3차원배열

int arr=int[2][];
arr[0]=int[4];
arr[1]=int[2];

int[2][]의 배열

String 배열은 살짝 다른거같다.

내가 공부한 토대로 생각한 그림

String object와 String 리터럴 차이점

내가 이해한 그림

 

String str=new String("Superman");
		String str2=new String("Superman");
	
		System.out.println(str);
		System.out.println(str2);
		
		
		if(str==str2) { //객체 위치르 비교하기떄문에 false;
			System.out.println("Same");
		}else {
			System.out.println("Diff");
		}
		
		if(str.equals(str2)) { //객체가 가지고있는 data true;
			System.out.println("Same");
		}else {
			System.out.println("Diff");
		}
		
		String str3="Superman2";
		String str4="Superman2";
	
		System.out.println(str3);
		System.out.println(str4);
		
		if(str3==str4) { //true
			System.out.println("Same");
		}else {
			System.out.println("Diff");
		}
		
		if(str3.equals(str4)) {//true
			System.out.println("Same");
		}else {
			System.out.println("Diff");
		}

몰입형 3일차.. 평소에 잘 이해한간 기초부분을 더 자세히 배우니 이해가 쏙쏙된다.. 신청하기 잘한거 같다. 

'몰입형학습' 카테고리의 다른 글

OSI 계층 모델 7계층 ~  (0) 2022.09.04
[Java]컬렉션 프레임워크  (0) 2022.07.07
[Java] 모듈화( method and function) and Class and this의 이해  (0) 2022.06.27
진법변환  (0) 2022.06.23
[JAVA] Stack and Heap  (0) 2022.06.22

댓글