November 21st, 2012, 10:41 PM
Confusing Dot Operator
I am learning Java and I have noticed when setting an image to an icon they use: Icon img1 = new ImageIcon(getClass().getResource("YES.png"));
getClass() method followed by a dot and another method next to it? If they were arguments to the ImageIcon constructor, shouldn't they be separated by commas? What does this mean?
In another topic, setLayout(new FlowLayout()); for example, uses the new operator inside a method without the object reference variable such as button = new button(); Why are they only using the new keyword without the object reference? How is this possible? Thank you all in advance for the responses, they are very appreciated.
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.