136, Java classes of internal

01. code is as follows:

Package Penalty for TIANPAN;

class Outer {                        // 外部类
    private String msg = "Hello World !";

    class Inner {                     // define an inner class 
        public  void Print () {
            System.out.println(msg);
        }
    }

    public  void Fun () {
         // instantiate class object inside, and call print () method 
        new new Inner () print ().;
    }
}

/**
 * Documentation comment here
 *
 * @Author Tin Pan micro-channel 382 477 247
  * / 
public  class TestDemo {

    public static void main(String args[]) {
        OUT Outer = new new Outer ();       // instantiate external object 
        out.fun ();                     // call external class method 
    }
}

 

02. Results are as follows:

 

 

Knowledge has a price, if you think this article valuable, authors agree to pay, micro-channel two-dimensional code can be any amount of a reward to the author (Micro Signal: 382 477 247) Oh, thank you.

 

 
 

Guess you like

Origin www.cnblogs.com/tianpan2019/p/12360196.html