Answer is B,
class MyClass implements AutoCloseable {
int test;
public void close() { }
public MyClass copyObject() {return this;}
}
public class Test {
public static void main (String[] args) throws InterruptedException {
MyClass obj = null;
try (MyClass obj1 = new MyClass()) {
obj1.test = 100;
obj = obj1.copyObject();
}
System.out.println(obj.test);
}
}
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Tarik2190
Highly Voted 3 years, 3 months agosteefaand
Most Recent 7 months agoduydn
11 months, 3 weeks agojduarte
3 years, 7 months ago