Newbie here. how can i implement this interface?

B

beau

I hava interface like this

// public interface CalculatorFunction {
// public void invoke();
// }

I gotto overide it with some other classes in order to make it perform
like a pocket calculator. I wrote this

// public class One implements CalcultorFunction {
//

and that's it. :p my lecturer sucks, really hard to understand what
he taught. and after just more than 1 month of studying Java he gave
me this project.
In this class I want to implement the button 1 function. could
somebody help?
Thanks in advance!

Beau
 
T

Thomas Kellerer

beau said:
I hava interface like this

// public interface CalculatorFunction {
// public void invoke();
// }

I gotto overide it with some other classes in order to make it perform
like a pocket calculator. I wrote this

// public class One implements CalcultorFunction {
//

and that's it. :p my lecturer sucks, really hard to understand what
he taught. and after just more than 1 month of studying Java he gave
me this project.
In this class I want to implement the button 1 function. could
somebody help?
Thanks in advance!

Beau

http://java.sun.com/docs/books/tutorial/java/interpack/interfaces.html
 
E

E.C. Bäck

beau said:
I hava interface like this

// public interface CalculatorFunction {
// public void invoke();
// }

I gotto overide it with some other classes in order to make it perform
like a pocket calculator. I wrote this

// public class One implements CalcultorFunction {
//

and that's it. :p my lecturer sucks, really hard to understand what
he taught. and after just more than 1 month of studying Java he gave
me this project.
In this class I want to implement the button 1 function. could
somebody help?
Thanks in advance!

Beau

That's crazy. You can't make that many classes and feel good about
yourself. If you keep this up, you'll have at least a dozen classes. But,
if you insist on it, you need to implement the interface. What that means
is that you need to have method in your child class with (in your case) a
void invoke method. Every variable or method specified (return types, too)
in an interface must be implemented in its children.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top