英文:
Can Java delet class object?
问题
有没有办法删除类对象 "obj"?
英文:
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" ?
答案1
得分: -3
Sure, here's the translated code:
// 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
}
}
英文:
> 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
}
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论