Results 1 to 2 of 2
- 12-17-2010, 01:39 AM #1
Member
- Join Date
- Dec 2010
- Posts
- 1
- Rep Power
- 0
Problems adding new method to an extending abstract class
In the program class:
...
URL url = new URL("http://www.google.com");
extURLConnection c = new extURLConnection(url.openConnection());
...
if (c.isConnected){
...
In URLConnection I cant access the attribute connected (that shows if i got a connection or not). so I want to add a method that return that attribute.
So I created a class called extURLConnection that extends URLConnection. As method connect() is abstract I must define this class as abstract. And this is here I get problems. Cause of this i cant initiate this class (as i written above). So how do I implement this isConnected method? Is it possible to do it in another way? I've read some thing about Interfaces, can it be done with that?
import java.net.*;
class DpURLConnection extends URLConnection{
DpURLConnection(URLConnection URLConn){
super(URLConn.getURL());
}
public boolean isConnected(){
return this.connected;
}
}
- 12-17-2010, 09:24 AM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
Similar Threads
-
SkeletonMidlet is not abstract and does not override abstract method
By just_in_deed in forum CLDC and MIDPReplies: 3Last Post: 08-13-2010, 04:57 AM -
...is not abstract and does not override abstract method...
By Addez in forum New To JavaReplies: 3Last Post: 09-16-2009, 09:27 PM -
Difference between Abstract class having only abstract method and a Interface class
By Santoshbk in forum New To JavaReplies: 6Last Post: 02-11-2009, 10:51 AM -
GameImpl is not abstract and does not override abstract method
By Macca07 in forum New To JavaReplies: 2Last Post: 11-21-2008, 12:20 AM -
Problems adding an external class
By jan2321 in forum EclipseReplies: 2Last Post: 11-06-2008, 10:34 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks