第2讲:语法

package com.test;

public class YuFa {

    @SuppressWarnings("unused")
    public static void main(String[] args) {
        // {}作用域
    int h;//作用域中不使用的变量,无需初始化
    int age = 10;//变量开头以字母下划线$等,不能以数字开头;这是注释!
    /*age=age+10;
              这是多行注释;
     *
     */
    byte a=127;
    int i=a;//自动类型转换
    
    
    int b=12;
    byte g=(byte) b;//强制类型转换
    
    short c=15;
    float d=12.3f;
    long e=13l;
    double f=15f;
    System.out.println(a+" "+b+" "+c+" "+d);
    System.out.println("a="+a+",i="+i);

    }

}        

 

posted @ 2016-10-14 13:59  故作无名状  阅读(86)  评论(0编辑  收藏  举报