|
-
Mar 22nd, 2006, 09:22 PM
#1
Thread Starter
Fanatic Member
Anonymous revised
Can I do like
Code:
Cell cell = new Cell() { public Cell() { this.setColumnSpan(3); }};
Or is there any another solution? Provided I only have a blank constructor (default).
-
Mar 22nd, 2006, 11:59 PM
#2
Re: Anonymous revised
No, you can't... The Java compiler will start a party
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Mar 23rd, 2006, 06:19 AM
#3
Frenzied Member
Re: Anonymous revised
I would try it and see. You can do the exact same thing with actionlisteners so I don't see why not. Anynonymous classes are allowed.
-
Mar 23rd, 2006, 02:37 PM
#4
Re: Anonymous revised
 Originally Posted by System_Error
I would try it and see. You can do the exact same thing with actionlisteners so I don't see why not. Anynonymous classes are allowed.
That's an interface, there is a big difference.
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Mar 23rd, 2006, 03:26 PM
#5
Frenzied Member
Re: Anonymous revised
Anonymous classes are allowed. If you think otherwise then you need a java certification book.
Neb, it seems that for an annoymous class to work you cannot have a named variable, so this should work:
new Cell() { public Cell() { this.setColumnSpan(3); }};
So you can't have a name and theirs no way to refer to them. Probably not what you are looking for, but anonymous classes ARE legal.
-
Mar 23rd, 2006, 03:31 PM
#6
Frenzied Member
Re: Anonymous revised
 Originally Posted by ComputerJy
That's an interface, there is a big difference.
No, that's an inner class implementing an interface.. there's a big difference.
-
Mar 23rd, 2006, 05:25 PM
#7
Re: Anonymous revised
 Originally Posted by System_Error
No, that's an inner class implementing an interface.. there's a big difference.
I'm good with that
But implementing A CONSTRUCTOR -- NO WAY
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
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
|