集册 Java实例教程 可见性与领域概念

可见性与领域概念

欢马劈雪     最近更新时间:2020-01-02 10:19:05

560
可见性与领域概念
 
/**
 from
* n o w    j a v a  . c o m 
**/

class TestClass {

     private long visibleOnlyInThisClass;

     double visibleFromEntirePackage; 

     

     void setLong (long val) {

         visibleOnlyInThisClass = val;

     }

     

     long getLong () {

        return visibleOnlyInThisClass;

     }  

}

 

public class Main {            

     public static void main(String[] args) {
     /**来自 
      时代Java - nowjava.com**/

         TestClass tc = new TestClass();  

         tc.setLong(32768);

        
展开阅读全文