Community
Participate
Working Groups
Given: package test; public class E01 { public static E01 create() { return new E01(10); } public E01(int j) { this(j, 10); } public E01(int j, int i) {} } 1. Select first constructor decl 'E01' 2. Refactor>Inline... 3. OK Is: Error Status: 'Cannot inline a constructor invocation that is used as a class instance creation' a) Why? b) Are constructor invocations that are not used as a class instance creation possible in java? Should: package test; public class E01 { public static E01 create() { return new E01(10, 10); } public E01(int j, int i) {} }
> b) Are constructor invocations that are not used as a class instance creation > possible in java? Yes, you can e.g. inline 'this(j, 10);'