java hello wrold
时间: 2023-03-02 14:57:07 浏览: 78
Sure, here's an example Java "Hello, World!" program:
```java
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
```
To run this program, you'll need to compile it and then run the resulting bytecode. Here's an example of how to do that using the command line:
1. Save the above code in a file named `HelloWorld.java`.
2. Open a command prompt or terminal window.
3. Navigate to the directory where you saved `HelloWorld.java`.
4. Compile the program by running the command `javac HelloWorld.java`. This will create a file named `HelloWorld.class`.
5. Run the program by running the command `java HelloWorld`. This should output the text "Hello, World!" to the console.
相关推荐
![java](https://img-home.csdnimg.cn/images/20210720083646.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)