Eclipse Java HelloWorld

本文介绍如何在Eclipse中创建一个简单的Java程序——HelloWorld。步骤包括新建Java项目和Java类,并在主方法中编写打印语句,最后运行程序。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

The following is slightly modified from http://www.eclipse.org/eclipse/faq/eclipse-faq.html#users_4:


How do I write a simple "Hello World" program?

To write a "Hello World" program follow these steps:

  1. Start Eclipse.
  2. Create a new Java Project:
    1. File->New->Project.
    2. Select "Java" in the category list.
    3. Select "Java Project" in the project list. Click "Next".
    4. Enter a project name into the Project name field, for example, "Hello World Project".
    5. Click "Finish"--It will ask you if you want the Java perspective to open. (You do.)
  3. Create a new Java class:
    1. Click the "Create a Java Class" button in the toolbar. (This is the icon below "Run" and "Window" with a tooltip that says "New Java Class.")
    2. Enter "HelloWorld" into the Name field.
    3. Click the checkbox indicating that you would like Eclipse to create a "public static void main(String[] args)" method.
    4. Click "Finish".
  4. A Java editor for HelloWorld.java will open. In the main method enter the following line.
         System.out.println("Hello World");
  5. Save using ctrl-s. This automatically compiles HelloWorld.java.
  6. Click the "Run" button in the toolbar (looks like a little man running).
  7. You will be prompted to create a Launch configuration. Select "Java Application" and click "New".
  8. Click "Run" to run the Hello World program. The console will open and display "Hello World".
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值