Java list items
java, list
Solution
Create your own `Rectangle` class and store those values in it.
List<Rectangle> rectangles = new ArrayList<>();
rectangles.add(new Rectangle("Foo", 20, 30));
Problem
Im using the following code ``` List<String> text = new ArrayList<String>(); text.add("Hello"); ``` So that list will only accept Strings to be added, how can I add into one list more types of variables like ints and strings together like Adding into the text list some rectangle values like rectangle name, rectangle width, rectangle height So later I can access them in a loop