Skip to content

Instantly share code, notes, and snippets.

@Harsimran1
Created December 3, 2020 02:12
Show Gist options
  • Save Harsimran1/6b747d94d4a8b3e49528261029df755d to your computer and use it in GitHub Desktop.
Save Harsimran1/6b747d94d4a8b3e49528261029df755d to your computer and use it in GitHub Desktop.
Java Interface Definition Example
interface Vehicle
{
// public and abstract
void drive();
}
// A class that implements the interface.
class Car implements Vehicle
{
// Implementing the capabilities of
// interface.
public void drive()
{
System.out.println("Drive");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment