JAVA的第二天学习
hello world 的源码
public class hello{
public static void main(String[] args){
System.out.println("Hello world!");
}
}
符号含义
class为类,public为访问权限的修饰符,main为程序入口方法,args为字符串变量名
println相当于c中的printf和python中的print
关于该程序的详细解释我找到了位网友的详细解释
[点击此处跳转至详细解释]((6条消息) java的"HelloWorld"代码解释_Cool_breeze_bin的博客-CSDN博客_hello world代码java)
注释符号
public class hello{
//单行注释
public static void main(String[] args){
/*多
行
注释*/
System.out.println("Hello world!");
}
}
- 双斜线进行单行注释
- /* 注释内容 */多行注释内不可嵌套使用
- 文档注释,JAVA特有
文档注释
/** 文档注释内容 */ ( 可被解析 )
public class hello{
/**
文档注释(可被被解析)
*/
public static void main(String[] args){
System.out.println("Hello world!");
}
}