wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes interface implementation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "interface implementation" Watch "interface implementation" New topic
Author

interface implementation

neha. bajaj
Ranch Hand

Joined: Jul 15, 2012
Posts: 31
neha. bajaj
Ranch Hand

Joined: Jul 15, 2012
Posts: 31
Oops.. hadn't implement interface
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7552
    
  18

neha. bajaj wrote:Oops.. hadn't implement interface

So, that's settled is it? I didn't see a question.

Winston


Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4343
    
    8

I think the implied question was "why is this implementation allowed when the return type is wider?".
neha. bajaj
Ranch Hand

Joined: Jul 15, 2012
Posts: 31
Matthew Brown wrote:I think the implied question was "why is this implementation allowed when the return type is wider?".

I don't think widening is working here.I tried but byte is not subtype of int but Byte is subtype of Number.
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7552
    
  18

neha. bajaj wrote:I don't think widening is working here.I tried but byte is not subtype of int but Byte is subtype of Number.

How is converting an int to a byte widening?

My suggestion: explain what you want to do, and ask a question; and we might be able to help.

Winston
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

byte is not a subtype of int, and long is not a supertype of int - there's no inheritance relationship between the primitive types.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Sirajuddin Khan
Greenhorn

Joined: Jul 07, 2012
Posts: 1
neha. bajaj wrote:


for your kind information, please check your code because it is not implement the interface's method so you got compile-time error.
You are doing overloading....
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7552
    
  18

Sirajuddin Khan wrote:please check your code...

Sirajuddin,

Please don't post very long lines in code. I broke yours up this time and I suggest you re-read the UseCodeTags page thoroughly.
This applies whether you are posting your own code or somebody else's.

Thanks.

Winston
 
wood burning stoves
 
subject: interface implementation
 
Similar Threads
Java Vectors
equals and hashCode
Regarding Autoboxing and Unboxing
q on interfaces