Last active
February 15, 2017 02:25
-
-
Save asd1245dss/e323c70b1d97a1b5b208e54a53a6952c to your computer and use it in GitHub Desktop.
Constructor Block will always be executed first before constructor method
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.wpg.demo.jdk8.stream; | |
import java.util.Arrays; | |
/** | |
* @author ChangWei Li | |
* @version 2017-02-15 10:14 | |
*/ | |
class NoMoreLoop { | |
{ | |
System.out.println("Constructor block 1"); | |
} | |
public NoMoreLoop() { | |
System.out.println("Constructor Method"); | |
} | |
{ | |
System.out.println("Constructor block 2"); | |
} | |
private static int[] nums = {0, 1, 2, 3, 4, 5}; | |
static void forEach() { | |
Arrays.stream(nums).forEach(System.out::println); | |
} | |
public static void main(String[] args) { | |
new NoMoreLoop(); | |
new NoMoreLoop(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment