`

java学习笔记1

阅读更多
java JDK  的安装就不说了,主要是安装完成后配置JAVA_HOME  CLASSPATH  PATH  路径

java语言 命名规则:
         1.类名首字母大写
         2.变量 为单个单词时: 全部小写 int value;,
           为多个单词时int intValue;:首个单词小写以后的单词首字母要大写,
           为常变量时:全部大写,单词之间用"_"隔开  如int INT_VALUE 21;
   变量初始化:
    全局变量中
         原始变量会在编译时赋给默认值 0
         String 初值 为null
         对象的初值为  null
    在局部变量中 变量不会有默认值;int a;    a = null;
 
    
   public class Test_Variable {
     static int a;
     static int d;
     public static void main(String[] args) {
		int b = 0;
		String c="cc" ;
		System.out.println(a);
		System.out.println(b);
		System.out.println(c);
		printd();
		
	}
     static void printd(){
    	 int e=3;
    	 System.out.println(d);
    	 System.out.println(e);
    	 System.out.println("str"+a+e);
    	 System.out.println(a+e);
    	 System.out.println(a+e+"str");
    	 System.out.println("str"+0+3);
     }
    
}



运行结果  :
0
0
cc
0
3
str03
3
3str
str03

static 对variable 和methods的 作用?
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics