Forward reference of Javac

Source: Internet
Author: User

can refer to jls7:https://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.3.2.3

public class Test5 {int a = m1 ();p Ublic int M1 () {System.out.println (i);  0return i;} int B = (new Object () {public int t () {System.out.println (i);//0return I;}}). T (); {i = 100; System.out.println (THIS.I); //i = i+1; Error cannot reference a field before it is defined//system.out.println (i); Error cannot reference a field before it is defined}//int k = i+1; Error  cannot reference a field before it is definedint i = 2;public static void Main (string[] args) {Test5 t = new Test5 (); System.out.println (T.I); 2}}

Forward reference of Javac

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.