fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5. /* Name of the class has to be "Main" only if the class is public. */
  6. class Ideone
  7. {
  8.  
  9.  
  10.  
  11. public void method(){
  12. String myVar = "this is a local variable";
  13. System.out.println(myVar);
  14. }
  15.  
  16.  
  17. public static void main (String[] args) throws java.lang.Exception
  18. {
  19. // your code goes here
  20. Ideone obj = new Ideone();//object created
  21. System.out.println("------------");
  22. obj.method();
  23. //integration in the console of obj with the instance variable
  24. System.out.println(obj.myVar);
  25. }
  26. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:24: error: cannot find symbol
		System.out.println(obj.myVar);
		                      ^
  symbol:   variable myVar
  location: variable obj of type Ideone
1 error
stdout
Standard output is empty