java基础知识要点总结之几个重要关键字(关于staticthisfinal)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了java基础知识要点总结之几个重要关键字(关于staticthisfinal)相关的知识,希望对你有一定的参考价值。

          you don‘t get anythin unless you create an object of that class with new, and at that point data storage is created and methods become available.

          But there are two situations in which this approach is not sufficient. One is if you want to have only one picec of storage for a particular piece of data,regardless of how many objects are created,or even if no objects are created. The other is if you need a method that isn‘t associated with any particular object of this class.以上是《thinking in java》里关于为什么要使用static关键字的描述,翻译过来即使基于以下两点理由:1.只需要在内存中保存一份数据;2.需要某种不和对象关联的数据。

         of course,since static methods don‘t need any objects to be created before they are used, they cannot directly access non-static members or methods by simply calling those other members without referring to a named object(since non-static members and methods must be tied to a particular object).这句话翻译过来就是说static 方法中不能直接非static的属性或者方法。

以上是关于java基础知识要点总结之几个重要关键字(关于staticthisfinal)的主要内容,如果未能解决你的问题,请参考以下文章

(算术基础)Shell脚本之几个随机数字的排列

总结了零基础学习Java编程语言的几个基础知识要点

MyBatis应用开发应用之几个重要概念

linux之几个重要的目录

入门Java你需要了解的几个知识要点!

谁帮我总结下java中的知识要点 和易错点 要系统的