# 第一支程式：新建檔案

> 在這章會學到：
>
> 1. 第一個程式 ：Hello JAVA
> 2. 程式解說

### 一、workspace

![首先開啟eclipse](/files/-M4NQiJSg3oP69I8eDwF)

![workspace為專案儲存目錄，依個人習慣存放](/files/-M4NQlB8f1yId3YpMaCS)

{% hint style="info" %}
一個worksplace可以新增很多package

一個package裡面可以新增很多class

Class就是你程式執行的地方
{% endhint %}

![點擊「Create a new Java project」，意指新增一個Java 專案](/files/-M4NROA7YLLX7a0N0pJ2)

### 二、Project

在「Project name」的地方輸入您的專案名稱，此教學為輸入「ch01」。&#x20;

此時在下方的Location就會顯示這項專案的資料夾建立在何處。 (您的workspace 建立在何處，Project就會建立在該資料夾底下)

![幫專案取名完可直接點擊最下方的「Finish」即可完成](/files/-M4NRSarnp9qd8pjWtJ7)

![幫專案取名完可直接點擊最下方的「Finish」即可完成](/files/-M4NRSarnp9qd8pjWtJ7)

![](/files/-M4NRhlsbbWv9V2gcyJb)

### 三、Package＆Class

{% hint style="info" %}
功能列上： 棕色正方形是新增Package 、綠色 C+ 則是新增Class
{% endhint %}

![先點擊１的部分：New Java Package](/files/-M4NRnuDEEWyHU6o2vhh)

這時會詢問Package 要建立在何處底下 與 Package名稱。 此教學以「ch01」名稱為例。 之後點擊Finish。

![](/files/-M4NS7Abx5qUM4ig0tMQ)

再來我們要新增Class；點擊２：New Java Class

![](/files/-M4NSBFLaDBVzaH-9-Vk)

在Name的地方輸入Class的名稱後，在底下的「public ststic void main(String\[] args)」打勾。

&#x20;此教學的Class名稱為「class01」；輸入完也打勾完後直接點擊最下方的「Finish」完成。

![](/files/-M4NSE42Sv9qWl9GzZ5M)

![紅框處是打程式碼的地方](/files/-M4NSFkuoU7PjFLLErmg)


---

# 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://java.4-x.tw/java-01/createfile.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.
