Skip to content

Instantly share code, notes, and snippets.

@arinto

arinto/Awesome.java

Last active Aug 29, 2015
Embed
What would you like to do?
A very simple Awesome interface
public interface Awesome {
/**
* say hello!
*/
void sayHello();
}
public class AwesomeSpaniard implements Awesome {
@Override
public void sayHello() {
System.out.println("Hola!");
}
}
public class BasicMain {
public static void main(String[] args) {
List<Awesome> awesomePeople = new LinkedList<>();
Awesome spaniard = new AwesomeSpaniard();
awesomePeople.add(spaniard);
Awesome indonesian = new AwesomeIndonesian();
awesomePeople.add(indonesian);
Awesome swedish = new AwesomeSwedish();
awesomePeople.add(swedish);
Awesome singaporean = new AwesomeSingaporean();
awesomePeople.add(singaporean);
awesomePeople.forEach(ap -> ap.sayHello());
}
}
Hola!
Halo!
Hej hej!
Hello!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.