package ex01_๊ฐ์ฒด๋ฐฐ์ด;public class Pokemon { // ํฌ์ผ๋ชฌ ์๋ฃํ // 1. ํ๋ public static final Pokemon pikachu = null; // ์ด๋ฆ private String name; // ํ์
private String type; // ๊ณต๊ฒฉ๋ ฅ private int atk; // ์ฒด๋ ฅ private int hp; // ์คํฌ private String skill; // 2. ๋ฉ์๋ // ๋ชจ๋ ํ๋๋ฅผ ์ด๊ธฐํ์ํฌ ์ ์๋ ์์ฑ์ public Pokemon(String name, String type, int atk, int hp, String skill) { this.name = name; this.type = type; this.atk = atk; ..

My Tech Blog (ํฌ์ผ๋ชฌ)
package ex01_๊ฐ์ฒด๋ฐฐ์ด;import java.util.Arrays;public class Main { public static void main(String[] args) { // 1. ๊ฐ์ฒด ๋ฐฐ์ด // ๋ฐฐ์ด์ด๋? // --> ๋์ผํ ์๋ฃํ์ ํ๋๋ก ๋ฌถ์ด์ ๊ด๋ฆฌํด์ฃผ๋ ์๋ฃ๊ตฌ์กฐ // ๋ฐฐ์ด ์ ์ธ ๋ฐฉ๋ฒ // ์๋ฃํ[] ๋ณ์๋ช
= new ์๋ฃํ[ํฌ๊ธฐ]; // ๋๋ง์ ์๋ฃํ // ํฌ์ผ๋ชฌ ๋ฐ์ดํฐ๋ฅผ 3๊ฐ ์ ์ฅ ํ ์ ์๋ bag ๋ฐฐ์ด ์์ฑ Pokemon[] bag = new Pokemon[3]; // ํฌ์ผ๋ชฌ์ ๋ํผ๋ฐ์ค ๋ณ์ํ์
- null(๊ธฐ๋ณธ๊ฐ) // new๋ ๋ํผ๋ฐ์ค ๋ณ์ ์์ฑํ๋ ํค์๋ // bag 0๋ฒ ๋ฐฉ์ ํผ์นด์ธ ๋ฐ์ดํฐ๋ฅผ ์ ์ฅ // ํผ์นด์ธ, ์ ๊ธฐ, 5000, 500..