1) 1Z0-816 (OCP part 2) + OCP: Java SE 11 Developer Yes, 2 OCP level exams No cert granted for completing 1Z0-815 OCP Part 1 (1Z0-815) similar to OCA 8 (1Z0-808) exam, but much harder!
• requires transitive – grant to caller • exports – share package • exports to – share package with specific module • opens – for reflection • provides/uses – for services 18
module-info? A. It must have a public modifier B. It cannot have a public modifier C. It appears at the root of the module D. Its name is moduleInfo.java 23
concepts from earlier versions of Java into the labs. (ex: reading from a file). • If you are not familiar with these, it is fine to Google or ask us for help. • Sample solutions are in the github repo. 25
methods allowed in interfaces • Why? Can be used by static and default methods to reduce code duplication • Can’t be used outside of interface declaration 29
Constants public static final Abstract Methods public abstract Default Methods (8) public default Instance Methods (9) private Public Static Methods (8) public static Private Static Methods (9) private static 30
independently been changed to _ in Java 9? A. 0 B. 1-2 C. 3-4 39 D. 5 or more E. None – code does not compile public interface Planet { int COUNT = 1; void add(int num); private static int getCount() { return COUNT; } }
i-> i + 1) .takeWhile(i -> i < 5) .forEach(System.out::println); Assumes ordered stream. Takes all elements until one doesn’t match. Prints the numbers 1-4 54
e -> new SimpleEntry<Integer,Integer>( e.getValue(), e.getKey()+e.getValue())) .map(Entry::getValue) .takeWhile(n -> n < 30) .forEach(System.out::println); How to print all Fibonacci #s less than 30? 55
i-> i + 1) .dropWhile(i -> i < 5) .forEach(System.out::println); Assumes ordered stream. Takes all elements until one doesn’t match. Prints the numbers 5-9 56
long count = Stream .iterate(1; i-> i< 10; i-> i+2).count(); System.out.println(count); A. 0 B. 5 C. 10 62 D. The code does not compile E. None of the above
Stream.iterate(1, i-> i< 10, i-> i++) .takeWhile(i -> i < 5) .forEach(System.out::println); A. The numbers 1-4 B. The numbers 5-9 C. An infinite stream 63 D. The code does not compile E. None of the above
long count = Stream .iterate(1, i-> i< 10, i-> i+2).count(); System.out.println(count); A. 0 B. 5 C. 10 64 D. The code does not compile E. None of the above
Stream.iterate(1, i-> i< 10, i-> ++i) .dropWhile(i -> i < 5) .forEach(System.out::println); A. The numbers 1-4 B. The numbers 5-9 C. An infinite stream 65 D. The code does not compile E. None of the above