-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
  • 135
  • 1
  • 10

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
  • 513,304
  • 74
  • 731
  • 1,106