πŸ“Š JAVA
Q. Which of the following is the output of this code, assuming it runs to completion?
Code:
public class Toy {
  public void play() {
  	System.out.print("play-");
  }
  public void finalizer() {
  	System.out.print("clean-");
  }
  public static void main(String[] fun) {
  	Toy car = new Toy();
  	car.play();
  	System.gc();
  	Toy doll = new Toy();
  	doll.play();
  }
}
  • (A) play
  • (B) play-play-
  • (C) play-clean-play-
  • (D) play-play-clean-clean-
πŸ’¬ Discuss
βœ… Correct Answer: (B) play-play-

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
305
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Ram Sharma
Publisher
πŸ“ˆ
90%
Success Rate