๋ฐ์ํ
package constructor;
public class Person {
String name;
float height;
float weight;
public Person() { // ๋ํดํธ ์์ฑ์
}
public Person(String name) { // ์ด๋ฆ์ ๋งค๊ฐ๋ณ์๋ก ์
๋ ฅ๋ฐ๋ ์์ฑ์
name = name;
}
public Person(String name, float pheight, float weight) { // ์ด๋ฆ, ํค, ๋ชธ๋ฌด๊ฒ๋ฅผ ๋งค๊ฐ๋ณ์๋ก ์
๋ ฅ๋ฐ๋ ์์ฑ์
name = name;
height = height;
weight = weight;
}
}
-ํด๋์ค์ ์์ฑ์๊ฐ ๋ ๊ฐ ์ด์ ์ ๊ณต๋๋ ๊ฒฝ์ฐ๋ฅผ ์์ฑ์ ์ค๋ฒ๋ก๋๋ผ๊ณ ํ๋ค.
๋ฐ์ํ
'Java' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[Java] ์ ๋ณด ์๋ (0) | 2021.02.18 |
---|---|
[Java] ์ฐธ์กฐ ์๋ฃํ (0) | 2021.02.18 |
[Java] ์์ฑ์ (0) | 2021.02.18 |
[Java] ํด๋์ค+์ธ์คํด์ค ๋ง๋ค๊ธฐ ์ค์ต (0) | 2021.02.18 |
[Java] ์ฐธ์กฐ ๋ณ์์ ์ฐธ์กฐ ๊ฐ (0) | 2021.02.18 |
๋๊ธ