Java: How will JVM optimise the call to a void and empty function?

前端 未结 6 909
囚心锁ツ
囚心锁ツ 2020-12-15 23:35

Let\'s imagine we have the following classes:

public class Message extends Object {}

public class Logger implements ILogger {
 public void log(Message m) {/         


        
6条回答
  •  抹茶落季
    2020-12-16 00:02

    I don't think java compiler will remove the call because the called method is empty, because you can change the method in future also without making any change in the main method.

提交回复
热议问题