" ์ •์  ๋ฉ”์„œ๋“œ ์™ธ์—๋„ ์ •์  ํด๋ž˜์Šค๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค. ๋‚˜์ค‘์— ์ด์— ๋Œ€ํ•ด ์ž์„ธํžˆ ์„ค๋ช…ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. ์ง€๊ธˆ์€ ์˜ˆ๋ฅผ ๋ณด์—ฌ ๋“œ๋ฆฌ๊ฒ ์Šต๋‹ˆ๋‹ค."

์˜ˆ:
public class StaticClassExample
{
    private static int catCount = 0;

    public static void main(String[] args) throws Exception
    {
        Cat bella = new Cat("Bella");
        Cat tiger = new Cat("Tiger");

        System.out.println("Cat count " + catCount);
    }

     public static class Cat
    {
        private String name;

        public Cat(String name)
         {
            this.name = name;
            StaticClassExample.catCount++;
         }
     }

}

" Cat ๊ฐœ์ฒด๋ฅผ ์›ํ•˜๋Š” ๋งŒํผ ๋งŒ๋“ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ์ •์  ๋ณ€์ˆ˜์˜ ๊ฒฝ์šฐ์—๋Š” ๊ทธ๋ ‡์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์ •์  ๋ณ€์ˆ˜์˜ ๋ณต์‚ฌ๋ณธ์€ ํ•˜๋‚˜๋งŒ ์กด์žฌํ•ฉ๋‹ˆ๋‹ค."

"ํด๋ž˜์Šค ์„ ์–ธ์—์„œ ์ •์  ์ˆ˜์ •์ž๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ์ฃผ์š” ๋ชฉ์ ์€ Cat ๊ณผ StaticClassExample ํด๋ž˜์Šค ์‚ฌ์ด์˜ ๊ด€๊ณ„๋ฅผ ์ œ์–ดํ•˜๋Š” โ€‹โ€‹๊ฒƒ์ž…๋‹ˆ๋‹ค . ์•„์ด๋””์–ด๋Š” ๋Œ€๋žต ์ด๋ ‡์Šต๋‹ˆ๋‹ค. Cat ํด๋ž˜์Šค๋Š” StaticClassExample ๊ฐœ์ฒด์— ์—ฐ๊ฒฐ๋˜์–ด ์žˆ์ง€ ์•Š์œผ๋ฉฐ ์ธ์Šคํ„ด์Šค์— ์•ก์„ธ์Šคํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค(๋น„- static) StaticClassExample ํด๋ž˜์Šค์˜ ๋ณ€์ˆ˜์ž…๋‹ˆ๋‹ค."

"๊ทธ๋Ÿฌ๋ฉด ์ˆ˜์—… ์•ˆ์— ์ˆ˜์—…์„ ๋งŒ๋“ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๊นŒ?"

"์˜ˆ. Java๋Š” ํ—ˆ์šฉํ•˜์ง€๋งŒ ์ง€๊ธˆ์€ ๋„ˆ๋ฌด ๋งŽ์ด ์ƒ๊ฐํ•˜์ง€ ๋งˆ์‹ญ์‹œ์˜ค. ๋‚˜์ค‘์— ๋ช‡ ๊ฐ€์ง€ ์‚ฌํ•ญ์„ ๋” ์„ค๋ช…ํ•˜๋ฉด ๋” ๋ช…ํ™•ํ•ด์งˆ ๊ฒƒ์ž…๋‹ˆ๋‹ค."

"๊ทธ๋žฌ์œผ๋ฉด ์ข‹๊ฒ ์–ด, ๋ฆฌ์‹œ."