-1

Iam new to Java GUI; the usage of "<>" is new to me. Can someone explain from the code below as used in the EventHandler? Also, is there a way to avoid using it?

btn.setOnAction(new EventHandler<ActionEvent>() {

        public void handle(ActionEvent event) {
            System.out.println("Hello World");
        } 
WKI
  • 215
  • 2
  • 3
  • 13
  • 4
    That's the syntax used in generics types (parametric polymorphism), http://docs.oracle.com/javase/tutorial/java/generics/types.html – Jack Dec 25 '14 at 20:09

1 Answers1

0

You can avoid it by using lambdas or method references with Java8

tomsontom
  • 5,856
  • 2
  • 23
  • 21