Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #11089 > unrolled thread
| Started by | John Goche <johngoche99@googlemail.com> |
|---|---|
| First post | 2012-01-07 13:15 -0800 |
| Last post | 2012-01-16 02:05 -0800 |
| Articles | 7 — 5 participants |
Back to article view | Back to comp.lang.java.programmer
please help understanding syntax John Goche <johngoche99@googlemail.com> - 2012-01-07 13:15 -0800
Re: please help understanding syntax Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2012-01-07 13:58 -0800
Re: please help understanding syntax Roedy Green <see_website@mindprod.com.invalid> - 2012-01-07 14:28 -0800
Re: please help understanding syntax Steven Simpson <ss@domain.invalid> - 2012-01-07 22:55 +0000
Re: please help understanding syntax Lew <noone@lewscanon.com> - 2012-01-07 20:58 -0800
Re: please help understanding syntax Steven Simpson <ss@domain.invalid> - 2012-01-08 08:25 +0000
Re: please help understanding syntax Roedy Green <see_website@mindprod.com.invalid> - 2012-01-16 02:05 -0800
| From | John Goche <johngoche99@googlemail.com> |
|---|---|
| Date | 2012-01-07 13:15 -0800 |
| Subject | please help understanding syntax |
| Message-ID | <7e21b19b-356f-4a0b-ae08-687fc79e1afa@dp8g2000vbb.googlegroups.com> |
Hello,
I am looking at the java code on the following page:
http://gnuc.in/resources/archives/1404
There I find the following, but I do not
understand the syntax Auth.background() { ... }
public void checkAccount(final Account account)
{
Auth.background()
{
@Override
public void run()
{
Auth.checkAccount(account, this, new CustomCallback()
{
@Override
public void handle(int resultCode)
{
// ...
}
});
}
});
}
Can someone please explain the syntax Auth.background() { ... } .
I understand the rest of the syntax.
Thanks,
John Goche
[toc] | [next] | [standalone]
| From | Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> |
|---|---|
| Date | 2012-01-07 13:58 -0800 |
| Message-ID | <68gbo9b7bbao$.1sppnkqjvas9g$.dlg@40tude.net> |
| In reply to | #11089 |
On Sat, 7 Jan 2012 13:15:43 -0800 (PST), John Goche wrote:
> [...]
> Can someone please explain the syntax Auth.background() { ... } .
> I understand the rest of the syntax.
The search term you are looking for is "anonymous inner class".
That should help you find lots of useful references online.
[toc] | [prev] | [next] | [standalone]
| From | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| Date | 2012-01-07 14:28 -0800 |
| Message-ID | <gmhhg7l33u67qln99juuqe3mcec73o33ub@4ax.com> |
| In reply to | #11089 |
On Sat, 7 Jan 2012 13:15:43 -0800 (PST), John Goche
<johngoche99@googlemail.com> wrote, quoted or indirectly quoted
someone who said :
>Can someone please explain the syntax Auth.background() { ... } .
>I understand the rest of the syntax.
see http://mindprod.com/jgloss/anonymousclasses.html
--
Roedy Green Canadian Mind Products
http://mindprod.com
If you can't remember the name of some method,
consider changing it to something you can remember.
[toc] | [prev] | [next] | [standalone]
| From | Steven Simpson <ss@domain.invalid> |
|---|---|
| Date | 2012-01-07 22:55 +0000 |
| Message-ID | <s4vmt8-k5m.ln1@news.simpsonst.f2s.com> |
| In reply to | #11089 |
On 07/01/12 21:15, John Goche wrote:
> public void checkAccount(final Account account)
> {
> Auth.background()
> {
> @Override
> public void run()
> {
> Auth.checkAccount(account, this, new CustomCallback()
> {
> @Override
> public void handle(int resultCode)
> {
> // ...
> }
> });
> }
> });
> }
>
> Can someone please explain the syntax Auth.background() { ... } .
It's a syntax error, surely? Try sticking it in a syntax-aware editor
with a 'class X { }' around it. When I add the closing brace in emacs,
I'm told "Mismatched parentheses".
Perhaps it's supposed to be 'new Auth.background()', though that's an
unconventional name for a class.
Perhaps it's supposed to be 'new Auth.background(new Runnable() { ...'.
...
--
ss at comp dot lancs dot ac dot uk
[toc] | [prev] | [next] | [standalone]
| From | Lew <noone@lewscanon.com> |
|---|---|
| Date | 2012-01-07 20:58 -0800 |
| Message-ID | <jeb7pk$og5$1@news.albasani.net> |
| In reply to | #11094 |
Steven Simpson wrote:
> John Goche wrote:
>> public void checkAccount(final Account account)
>> {
>> Auth.background()
>> {
>> @Override
>> public void run()
>> {
>> Auth.checkAccount(account, this, new CustomCallback()
>> {
>> @Override
>> public void handle(int resultCode)
>> {
>> // ...
>> }
>> });
>> }
>> });
>> }
>>
>> Can someone please explain the syntax Auth.background() { ... } .
>
> It's a syntax error, surely? Try sticking it in a syntax-aware editor with a
> 'class X { }' around it. When I add the closing brace in emacs, I'm told
> "Mismatched parentheses".
>
> Perhaps it's supposed to be 'new Auth.background()', though that's an
> unconventional name for a class.
>
> Perhaps it's supposed to be 'new Auth.background(new Runnable() { ...'.
>
> ...
Whatever it's supposed to be, the code at that site is not compilable, nor
does the author even provide complete classes. It is evidence that mere
presence on the Web does not make for good information.
--
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg
[toc] | [prev] | [next] | [standalone]
| From | Steven Simpson <ss@domain.invalid> |
|---|---|
| Date | 2012-01-08 08:25 +0000 |
| Message-ID | <uf0ot8-jun.ln1@news.simpsonst.f2s.com> |
| In reply to | #11094 |
On 07/01/12 22:55, Steven Simpson wrote:
> Perhaps it's supposed to be 'new Auth.background()', though that's an
> unconventional name for a class.
>
> Perhaps it's supposed to be 'new Auth.background(new Runnable() { ...'.
D'oh! For the Runnable case, I meant 'Auth.background(new Runnable()
{...'. Too many 'new's. Not that the extra 'new' was necessarily
wrong, just not intended.
--
ss at comp dot lancs dot ac dot uk
[toc] | [prev] | [next] | [standalone]
| From | Roedy Green <see_website@mindprod.com.invalid> |
|---|---|
| Date | 2012-01-16 02:05 -0800 |
| Message-ID | <6ht7h7t29ue7qh0hkocu8pv08iotc8is9f@4ax.com> |
| In reply to | #11094 |
On Sat, 07 Jan 2012 22:55:55 +0000, Steven Simpson <ss@domain.invalid>
wrote, quoted or indirectly quoted someone who said :
>It's a syntax error, surely? Try sticking it in a syntax-aware editor
>with a 'class X { }' around it. When I add the closing brace in emacs,
>I'm told "Mismatched parentheses".
for samples of anonymous classes that will compile, see
http://mindprod.com/jgloss/anonymousclasses.html
--
Roedy Green Canadian Mind Products
http://mindprod.com
One of the most useful comments you can put in a program is
"If you change this, remember to change ?XXX? too".
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web