java入门篇

作者: java大哥 | 来源:发表于2017-11-29 13:33 被阅读0次

    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);

    */

    }

    }

    相关文章

      网友评论

        本文标题:java入门篇

        本文链接:https://www.haomeiwen.com/subject/bpmubxtx.html