eventqueue meaning of arrow

45 Views Asked by At

because I couldn't find anything in google that would explain that, I decided to turn myself to ask you what the arrow in this specific example does, I never saw that expression so I don't really get it what it does.

Site I try to learn from: http://zetcode.com/tutorials/javagamestutorial/basics/

Thanks for helping!~

   public static void main(String[] args) {

        EventQueue.invokeLater(() -> {
            Application ex = new Application();
            ex.setVisible(true);
        });
    }
1

There are 1 best solutions below

3
jspcal On BEST ANSWER

It's part of a lambda expression, which is a shorthand for defining functions. This creates a class with a method that takes no arguments and executes the statement block.

() -> {
    Application ex = new Application();
    ex.setVisible(true);
}