java入门篇

来源:互联网 发布:java调用rest api实例 编辑:程序博客网 时间:2024/06/02 00:35

MyEclipse 8.5编辑器

package second;



public class test {
public static void main(String[] args) {
//单行注释System.out.println("java practice1");

/*多行
            注释*/

/**
* 文档注释
* @param args
*/
/*标识符:在Java中,对于程序的命名
* 可以是26个字母(大小写)+0-9
* 符号:_,$
* 开头不能是数字
*/

/*System.out.println("java practice1");
System.out.println("asdfghjkl");*/
// 变量类型 变量名=变量值
//String str="hello java!"; //声明(创建)一个变量
//System.out.println(str);
//str="welcome";
//System.out.println(str);
//final关键字 常量类型 常量名=常量值
final String str="hello java!"; //声明(创建)一个常量
System.out.println(str);
//str="welcome";
System.out.println(str);

final String str100="f S str";//声明(创建)一个常量
System.out.println(str100);
//System.out.println(str100);

/*
int cnt=0;//声明(创建)整型变量
float price=0.0f;//声明(创建)浮点型变量
double score=68.3;//声明(创建)双雕浮点型该变量
char c='a';//声明(创建)字符型变量     (单引号,单个字符)
String str1="welcome";//声明(创建)字符串常量    (双引号,多个字符)
System.out.println(cnt);
System.out.println(price);
System.out.println(score);
System.out.println(c);
System.out.println(str1);
*/
}
}