fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. class Aaa {
  8. Bbb reference;
  9.  
  10. public Aaa (Bbb reference) {
  11. this.reference = reference;
  12. }
  13. }
  14.  
  15. class Bbb {
  16. int a = 10;
  17. }
  18.  
  19. /* Name of the class has to be "Main" only if the class is public. */
  20. class Ideone
  21. {
  22. public static void main (String[] args) throws java.lang.Exception
  23. {
  24. Bbb objectB = new Bbb();
  25. Aaa objectA = new Aaa(objectB);
  26. objectA.a = 14;
  27. }
  28. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:26: error: cannot find symbol
		objectA.a = 14;
		       ^
  symbol:   variable a
  location: variable objectA of type Aaa
1 error
stdout
Standard output is empty