scala Quick Start Series] [anonymous inner classes

        Benpian scala fast as twenty five series of blog entry, for everyone to bring about an anonymous inner class content.

Here Insert Picture Description


Anonymous inner classes

        Anonymous inner classes is not the name of a subclass to directly create an instance of an object. Spark source code to use a large number of anonymous inner classes.

        Anonymous inner classes in scala consistent with Java.

definition

grammar
Here Insert Picture Description

Examples

Example shows

  1. Create a Person abstract class, and add an abstract method sayHello
  2. Add the main method to achieve Person by creating an anonymous inner class
  3. Call the anonymous inner class object's sayHello method

Reference Code
Here Insert Picture Description


        This issue of content sharing on here, like little friends remember a point like this, continued attention to the next one will bring you yo ~TraitTo share, so stay tuned 9 (1> ◡ <1) 6

Here Insert Picture Description

Published 169 original articles · won praise 1392 · Views 380,000 +

Guess you like

Origin blog.csdn.net/weixin_44318830/article/details/104076182