๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
Java

[Java] ์ฐธ์กฐ ๋ณ€์ˆ˜์™€ ์ฐธ์กฐ ๊ฐ’

by ์ฝ”๋”ฉํ•˜๋Š” ๋ถ•์–ด 2021. 2. 18.
๋ฐ˜์‘ํ˜•

โ–ถ ์ฐธ์กฐ ๋ณ€์ˆ˜์™€ ์ฐธ์กฐ ๊ฐ’

package classpart;

public class StudentTest2 {
	public static void main(String[] args) {

		Student student1 = new Student();
		student1.studentName = "์•ˆ์—ฐ์ˆ˜";

		Student student2 = new Student();
		student2.studentName = "์•ˆ์Šน์—ฐ";

		System.out.println(student1);  // ์ฐธ์กฐ ๋ณ€์ˆ˜ ๊ฐ’ ์ถœ๋ ฅ
		System.out.println(student2);  // ์ฐธ์กฐ ๋ณ€์ˆ˜ ๊ฐ’ ์ถœ๋ ฅ
	}
}

 

 

<๊ฒฐ๊ณผ๊ฐ’>

-ํž™ ๋ฉ”๋ชจ๋ฆฌ์— ์ƒ์„ฑ๋œ ์ธ์Šคํ„ด์Šค์˜ ๋ฉ”๋ชจ๋ฆฌ ์ฃผ์†Œ๋Š” ์ฐธ์กฐ ๋ณ€์ˆ˜์— ์ €์žฅ๋œ๋‹ค.

-ํ•ด์‹œ ์ฝ”๋“œ(hash code)๊ฐ’ : ์ž๋ฐ” ๊ฐ€์ƒ ๋จธ์‹ ์—์„œ ๊ฐ์ฒด๊ฐ€ ์ƒ์„ฑ๋˜์—ˆ์„ ๋•Œ ์ƒ์„ฑ๋œ ๊ฐ์ฒด์— ํ• ๋‹นํ•˜๋Š” ๊ฐ€์ƒ ์ฃผ์†Œ ๊ฐ’.

โ€‹

โ€‹

**๋ฉค๋ฒ„ ๋ณ€์ˆ˜๋Š” ์ดˆ๊ธฐ๊ฐ’์„ ์•ˆ์ค˜๋„ ์ƒ๊ด€X

๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€