• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

sheer mind-searing frustration - arghh

 
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On compiling I keep getting this error :

RemotedbClient.java :14: com.developer.Tunnel.RemotedbClient should be declared abstract; it does not define connect() in com.developer.Tunnel.RemotedbClient.
public class RemotedbClient

That's because it is the client proxy where I create the input and output stream for reading and flushing records.
It has absolutelu nothing to do with connect() which is handled somewhere else.
Arghhh
 
achana chan
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I really don't understand why I am forced to declare a class abstract. Consider this :

This is the simple code for ORCLInterface

The rest of the codes compile okay except for RemotedbClient, which insists that I declare it an abstract class because I am not using
connect() from ORCLInterface...
Sometimes, SUN-JAVA could make it a bit easier for people like me, just sometimes.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As near as I can tell, the compiler is correct. If you declare that a class implements an interface, you must provide a public method for each method in the interface.
Lots of people trip on that public bit.
Are you perhaps attempting to run before you learn how to walk with Java?
Bill
 
achana chan
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, but why does Java force me to declare the "calling" class abstract ?
This works because I declared it abstract :


Is this because I am not using one of the public methods in the sub-class, in this case connect() ?

I am not using it because connect() is a public method from another class which sets up an Oracle pool. I get an available connection from this physical pool
I use my own pool because I understand it and I can control it. I do not use Tomcat's pool because I don't understand it and I cannot control it.
 
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're missing the target a bit here.
You don't need to declare anything abstract. This is just the compilers way of saying that it found a method in the interface that you are implementing that is not in the class.
So, if you have:
interface MyInterface
public void method1();
public String method2();
In your implementation you must have:
class Thing1 implements MyInterface
public void method1() {}
public String method2() {}
I often see this error when I decide that a method should have a new parameter, but failed to add it to the interface.
 
achana chan
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.
It has to be boolean , as in
public boolean connect();
In the client app, it asks me for a return value. It's just a placeholder, I guess returning null should be alright. So I ended up with something like this :

That compiles and work.
Sad.
 
achana chan
Ranch Hand
Posts: 277
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks All.
Thanks Bill.
Thanks Chris.
It works now after inserting the dummy methods in the client app.
:roll:
 
reply
    Bookmark Topic Watch Topic
  • New Topic