Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #2066

Re: newbie interface question

Newsgroups comp.lang.java.help
Date 2012-08-28 14:08 -0700
References <895c9d20-3ae1-4eee-b1a4-513e75b93fdb@c4g2000vbe.googlegroups.com> <k1h476$57q$1@dont-email.me> <d2228972-1080-4803-bb99-7355b11148ea@l14g2000yqo.googlegroups.com> <k1ieav$nqm$1@dont-email.me>
Message-ID <57b88270-eafb-4cdc-b558-63dca0183366@googlegroups.com> (permalink)
Subject Re: newbie interface question
From Lew <lewbloch@gmail.com>

Show all headers | View raw


Eric Sosman wrote:
>happytoday wrote:
>> Eric Sosman wrote:
>>>  happytoday wrote:
>>>> I am testing interface but really I can not apply what is explained in
>>>> oracle [sic] tutorials . Could you please explain why I have errors with
>>>> this code :
>>>> [...]
>>>       What "errors" do you have?  For me, the code compiles just
>>> fine, and runs [...]
> 
>> prog01_BicycleDemo_interface_trial01.java:62: printresults() in
>> ACMEBicycle cannot implement printresults() in Bicycle; attempting to
>> assign weaker access privileges; was public
>> void printresults()
>>       ^
> 
>     Aha!  So by "this code" you meant "some other piece of code
> altogether," right?  Do you know how many times "ACME" appears
> in the code sample you posted?  Z E R O times, that's how many.
> 
>      Unfortunately, I am not sufficiently skilled to debug code
> that I cannot see.  My guess (but I'm only guessing) is that
> you've converted Bicycle from a class to an interface, thus
> making its methods public automatically even if you don't use
> the `public' keyword.  Then (still guessing) you've written an
> ACMEBicycle class that implements Bicycle, and you've tried to
> give it an implementation of the printresults() method specified
> by the Bicycle interface.  But the interface says printresults()
> must be a `public' method, while ACMEBicycle's printresults()
> isn't marked `public'.
> 
>      There are other possible explanations, but I'm tired of
> guessing about unseen code and my Magic 8 Ball has a virus.

"All indications point to No!"

The Magic Infinity Ball (you were looking at yours sideways) only 
answers "Yes" or "No" questions.

Fortunately the OP asked a "Yes" or "No" question.

-- 
Lew

Back to comp.lang.java.help | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: newbie interface question Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-08-27 20:43 -0400
  Re: newbie interface question Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-08-28 08:42 -0400
    Re: newbie interface question Lew <lewbloch@gmail.com> - 2012-08-28 14:08 -0700
    Re: newbie interface question Gene Wirchenko <genew@ocis.net> - 2012-08-28 17:21 -0700
  Re: newbie interface question Roedy Green <see_website@mindprod.com.invalid> - 2012-08-29 08:26 -0700

csiph-web