Read Also: resource is out of sync with the filesystem error in eclipse
As always, we will produce the error first before moving on to the solution.
Fixed: insert dimensions to complete referencetype
1. Below code will give a compilation error in eclipse:import java.util.*; public class InsertDimensionsError { public static void main(String[] args) {Map<String, int> map;} }
Output:
Explanation
In the above code, we are passing primitive data type 'int' instead of the wrapper class. We can fix this error by replacing it with the corresponding wrapper class i.e Integer.
Solution:
import java.util.*; public class InsertDimensionsError { public static void main(String[] args) {Map<String, Integer> map;} }
2. Another example of insert dimensions to complete referencetype error is:
import java.util.*; public class InsertDimensionsError2 { public static void main(String[] args) {List<double> listObj = new ArrayList<>();listObj.add(15.0); listObj.add(30.0); System.out.println(listObj); } }
Output:
Explanation
In the above example, we are passing primitive data type 'double' instead of the wrapper class. We can fix this error by replacing it with the corresponding wrapper class i.e Double as shown below:
Solution:
import java.util.*; public class InsertDimensionsError2 { public static void main(String[] args) {List<Double> listObj = new ArrayList<>();listObj.add(15.0); listObj.add(30.0); System.out.println(listObj); } }
Output:
[15.0,30.0]
That's all for today, please mention in the comments in case you have any questions related to insert dimensions to complete referencetype.