# 소스파일 작성 및 실행

## 소스코드 파일 생성

생성한 패키지를 우클릭하고 `New` → `Class`를 선택하여 소스코드를 작성할 수 있는 파일을 생성한다. 이름은 `Hello`로 설정한다.

![](/files/-MgtdotWMabzDiUw791c)

## 생성된 파일 확인

파일이 생성되면 다음과 같은 코드가 작성되어 있다.

```java
package test;

public class Hello {

}
```

## 샘플 코드

작성된 코드를 제외한 나머지 영역에 코드를 추가하여 다음과 같은 프로그램을 구현한다.

```java
package test;

import java.lang.*;

public class Hello {
    public static void main(String[] args){
        //Sample Java Program
        System.out.println("Hello World!");
    }
}
```

## 실행

`Run` 메뉴의 `Run`을 누르거나 단축키 `Ctrl+F11`을 눌러 실행한다. 다음 글자가 출력되면 성공이다.

```
Hello World!
```

```
System.out.println("Hello World!");
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sysout.co.kr/etc/eclipse-ide/code-and-execute.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
