094, heap memory when the direct assignment of the String class in Java automatically referenced

01. code is as follows:

Package TIANPAN; 

/ ** 
 * Notes document here 
 * 
 * @author Tin Pan micro-channel 382 477 247
  * / 
public  class TestDemo {
     public  static  void main (String args []) { 
        String value of the stra = "Hello";                 // assigned directly instantiated 
        STRB = String "the Hello";                 // assigned directly instantiated 
        String = STRC "the Hello";                 // assigned directly instantiated 
        String strd = "good";                    // direct assignment instantiated, the content is not the same as 
        System.out.println (stra STRB ==);      // determination result: true
        System.out.println (value of the stra == STRC);      // Analyzing Results: to true 
        System.out.println (STRB == STRC);      // Analyzing Results: to true 
        System.out.println (value of the stra == STRD);      // Analyzing results: to false 
    } 
}

 

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/12325886.html