This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes using interface and how to implement them Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "using interface and how to implement them" Watch "using interface and how to implement them" New topic
Author

using interface and how to implement them

Duc Nguy
Greenhorn

Joined: Nov 12, 2001
Posts: 7
I have to develop number of vehicle types using the following interface. How do i use them
public interface Driveable
{
public static final int LEFT = 0;
public static final int RIGHT = 1;
public void start();
public void stop();
public void accelerate();
public void decelrate();
public void turn (int direction);
}
I have to write an classs for van, sedan that implement the inerface. please help.
James Hobson
Ranch Hand

Joined: Aug 28, 2001
Posts: 140
you want something like this
/**
* Put some javadoc here
*/
public class Van implements Driveable {
public static void main(String args) {
Driveable aVanInstance = new Van();
aVanInstance.start();
aVanInstance.turn(90);
aVanInstance.stop();
}

public void start() {
//do something
}
public void stop() {
//do something
}
public void accelerate(){
//do something
}
public void decelrate(){
//do something
}
public void turn (int direction){
//do something
}
}
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: using interface and how to implement them
 
It's not a secret anymore!