用户:
Godeyes查看:8 回复:11 评论:8 创建时间:2020-04-24T10:04:44
前言:
在大部分的编程语言,刚开始都是编写HelloWorld的程序吧。而在java中helloworld又是怎样的呢?
程序:
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World");
}
}
正片:
肯定有很多人一看到这个程序就懵逼了,但不用慌,接下来我会详细讲解:
第一句:public class HelloWorld是什么意思呢??
其实很简单,public是公开的意思,class表示的是一个类,合起来就是公开的类。
(切记:当你使用了public class语法,你的java程序名就一定得和class后面的类名相同,否则就会报错,换句话说,class后面是HelloWorld,你的java文件名就一定得是HelloWorld!!!别问我为什么,这是java SUN公司规定的!!!切记切记)
第二句:那public static void main(String[] args)又是什么意思???
其实啊,这个句子相当于一个入口,这是sun公司规定的,除了args可以修改,其他一定不能修改!!!
这个要喵记(其实也不用,当你敲多了,自然就记住了)
第三句:System.out.println这个句子我们暂不做解释,在接下来的教程里,我会讲到
历史教程:
Java学习教程(第一章)[介绍java]:https://shequ.codemao.cn/wiki/forum/281707
java学习教程(第二章)[java的注释]:https://shequ.codemao.cn/community/281722
程序可以这样写
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World");
}
}点赞0
评论
星空之忆#import <Foundation/Foundation.h>
int main(int argc, const char * argv[]) {
@autoreleasepool {
NSLog(@"Hello, World!");
NSInteger s = 10;
BOOL a = YES;//NO
BOOL b = TRUE;//FALSE
NSString *str = @"jiangwei";
NSLog(@"%@",str);
NSRange rang = {1,3};
NSMakeRange(1,3);
}
return 0;
}点赞0
评论
#include<iostream>
using namespace std;
int main (){
cout<<"Hello World";
return 0;
}
//这个是C加加的helloworld程序,可以对比点赞0
评论
GodeyesJava学习教程(第一章)[介绍java]:https://shequ.codemao.cn/community/281707
java学习教程(第二章)[java的注释]:https://shequ.codemao.cn/community/281722
Java(第三章)[编写第一个java程序]:https://shequ.codemao.cn/community/281753
Java(特殊篇)[运行和编译java程序]:https://shequ.codemao.cn/community/281785
Java学习教程(第四章)[标识符与关键字]:https://shequ.codemao.cn/community/282020
Java学习教程(第五章)[变量]{1.字面量}:https://shequ.codemao.cn/community/282531
Java学习教程(第五章)[变量]{变量概述}:https://shequ.codemao.cn/community/283059
Java学习教程(第五章)[变量]{使用变量}:https://shequ.codemao.cn/community/283194
[教程帖]Java学习教程第五章[变量]{变量分类}:https://shequ.codemao.cn/community/283732
[教程帖]Java学习教程(第五章)[变量]{变量作用域和章节总结}:https://shequ.codemao.cn/community/283745
[教程帖]Java学习教程(第六章)[数据类型]{数据类型概述}:https://shequ.codemao.cn/community/284512
[教程帖]Java学习教程(第六章)[数据类型]{字符编码}:https://shequ.codemao.cn/community/285286
[教程帖]Java学习教程(第六章)[数据类型]{字符型详解 理解}:https://shequ.codemao.cn/community/286136
[教程帖]Java学习教程(第六章)[数据类型]{整数型详解(理解)}:https://shequ.codemao.cn/community/289851
[教程帖]Java学习教程(第六章)[数据类型]{布尔型详解(理解)}:https://shequ.codemao.cn/community/290606
[教程帖]Java学习教程(第六章)[数据类型]{ 浮点型详解(理解)}:https://shequ.codemao.cn/community/291409
[教程帖]Java学习教程(第六章){基本数据类型转换 理解}:https://shequ.codemao.cn/community/292208
[教程帖]Java学习教程(第六章){章节总结}:https://shequ.codemao.cn/community/293610
点赞0
评论