CODEARTS IDE-用生成器替换构造函数:重构前

时间:2024-04-16 15:05:23

重构前

class ReplaceConstructor {
   public static void main(String[] args) {
      new InnerClass("Hello", "World").print();
   }

   private static class InnerClass {
      private String message;

      public InnerClass(String hello, String world) {
         message = hello + ", " + world;
      }

      public void print() {
         System.out.println(message);
      }
   }
}
support.huaweicloud.com/usermanual-codeartside/codeartside_01_0150.html