基本概念以及与python的区别:
1 明确源文件,类,方法,语句这几个概念
2 while()和if()的条件只能是布尔值,以下程序不行,但是python却可以
int x=1;
while(x){}
//if(x){}
3 println相比print多了一个换行的功能
system.out.println("lcc")
4 void main前面的void表示没有返回值(勾起了之前学C++的回忆)
5 安装并配置eclipse,注意:eclipse版本一定要和jdk相对应
jdk版本https://www.oracle.com/technetwork/java/javase/downloads/jdk10-downloads-4416644.html
参考网址:https://www.cnblogs.com/quickcodes/p/5399385.html
相关指令如下:
扫描二维码关注公众号,回复:
3622121 查看本文章
出现的错误:
Must declare a named package because this compilation unit is associated to the named module '***'
原因是创建完项目后,要创建一个包再创建一个类,不创建包直接创建类就会出现如上问题。
6 数组的声明和创建
string [] pets ={"a","b","c"}
7 转换数据类型(对浮点数取整数值)
int x =(int) 289.3