-1

My code:

public class Main {
    
    public static void main(String[] args) {
        OuterClass obj = new OuterClass();
        
    }
}

There is a way that i can delet the Class object "obj" ?

Ziv Sion
  • 165
  • 1
  • 11

1 Answers1

-3

delet, Disable the option to use obj again

You can do this.

public class Main {
    public static void main(String[] args) {
        { 
            OuterClass obj = new OuterClass();
        }
        // the field obj no longer exists.
        String obj = "hi"; // this works as the previous `obj` doesn't apply here
        
    }
}
Peter Lawrey
  • 525,659
  • 79
  • 751
  • 1,130