C#프로그래밍

static

다모아 2023. 7. 21. 10:28
using System;

namespace LearnDotnet
{
    internal class Program
    {   //static은 가장 먼저 메모리 실행, 종료될 때까지 살아있음
        static int maxHp = 10; //클래스 안에 있으면 필드, 멤버변수, 전역변수
        static void Main(string[] args)
        {
            //static은 static끼리만 사용가능
            int hp = maxHp; //메서드 안에 있으면 지역변수
        }

    }
}

'C#프로그래밍' 카테고리의 다른 글

클래스 정의[중요]  (0) 2023.07.21
메서드  (0) 2023.07.21
break  (0) 2023.07.21
while  (0) 2023.07.21
if, switch  (0) 2023.07.21