摘要: 工具类方法一般是静态方法。是为了方便编程的。 example: class gongJu{ public static void sum(int a,int b){ System.out.println(a+b); } public static double div(double a,double 阅读全文
posted @ 2020-10-08 23:51 柠檬tea的味道 阅读(126) 评论(0) 推荐(0)
摘要: 1、 static String country=“中国”; 每个对象的country都一样,为了节省存储空间使用static。(在方法区内存中调用类时便定义了country的字面值)这这样每个对象的country都是中国,构造方法中可以不写country了。 2、 static{ ........ 阅读全文
posted @ 2020-10-08 22:55 柠檬tea的味道 阅读(103) 评论(0) 推荐(0)
摘要: public class text{ // 没有statc的变量i int i=19; // 带有static的变量abstract static int a=10; // 带有static的方法doSome public static void doSome(){ System.out.print 阅读全文
posted @ 2020-10-08 19:18 柠檬tea的味道 阅读(76) 评论(0) 推荐(0)