java编写到编译到运行_如何编写,编译和运行您的第一个Java程序?

java编写到编译到运行


java. For installation guide read: 
Java的 有关安装指南,请阅读: Java Installation: Downloading, Installing and Setting PathJava安装:下载,安装和设置路径

如何编写和运行Java程序? (How to write and run Java programs?)

  • Open notepad and write below program.

    打开记事本并编写以下程序。
class demo 课堂示范
{ {
                public
static void main(String…S)
上市 静态void main(String ... S)
                { {
                                System.out.println(“Java
Programming”);
System.out.println(“ Java 编程”);
                } }
} }
First Java Program
  • Now save the file with name demo.java on desktop. Here you can replace demo with any other name that you want.

    现在,在桌面上将文件保存为demo.java 。 在这里,您可以将demo替换为所需的任何其他名称。

  • Then open command prompt (cmd) and type cd desktop and press enter to change current directory to desktop.

    然后打开命令提示符(cmd)并键入cd桌面 ,然后按Enter键将当前目录更改为桌面。

    We changed directory because our program is saved on desktop.

    我们更改了目录,因为我们的程序保存在桌面上。

cd desktop
  • To compile java program type javac demo.java and hit enter. Type java demo to run the program. Remember that here we have to compile

    要编译Java程序,请输入javac demo.java并按Enter。 键入java demo来运行程序。 请记住,这里我们必须进行编译

    with program name and execute with class name that we have used in program. The

    使用程序名称,并使用我们在程序中使用的类名称执行。 的

    java program name and class name can be different.

    java程序名称和类名称可以不同。

compile and run

了解计划 (Understand the Program)

Understand the Program
System: Get reference id of the device on 系统:获取设备的参考ID
which program is running. Here the device is cmd.
哪个程序正在运行。 此处设备为cmd。
out: Store the reference id of device. out:存储设备的参考ID。
println: Throw the output on device.
println:将输出 扔到设备上。
A.java
A.java
A.java
class A
 {
}
class A
{
public static void main()
{
}
}
compile
Yes
Yes
Yes
.class file
Not created
Created
Created
execute
No
No
Yes
A.java
A.java
A.java
A级
{
}
A级
{
公共静态void main()
{
}
}
编译
.class文件
未建立
已建立
已建立
执行
没有
没有

翻译自: https://www.thecrazyprogrammer.com/2014/06/how-to-write-compile-and-run-your-first-java-program.html

java编写到编译到运行

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值