-
November 21st, 2012, 10:41 PM
#1
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|