Java编程入门:从基础到实践
1. 编写第一个Java程序
1.1 程序运行逻辑
当计算机运行程序时,会执行主语句块中的每一条语句。以下是一个用英语描述的 Saluton 程序逐行分解:
1: The Saluton program begins here:
2: The main part of the program begins here:
3: Store the text “Saluton mondo!” in a String variable named greeting
4: Display the contents of the variable greeting
5: The main part of the program ends here.
6: The Saluton program ends here.
这个程序主要完成了两件事:将文本 “Saluton mondo!” 存储在名为 greeting 的字符串变量中,然后显示该变量的内容。
1.2 编译程序
在运行Java程序之前,需要先将其编译。编译的过程是将我们编写的指令转换为计算机更容易理解的形式,同时让程序尽可能高效地运行。Java程序必须在编译后才能运行,使用软件开发工具包(SDK)中的 javac 程序进行编译。 javac 是一个命令行工具,具体操作步骤如下:
超级会员免费看
订阅专栏 解锁全文
3384

被折叠的 条评论
为什么被折叠?



