More Related Content
Similar to Pebank java handsout (20)
Pebank java handsout
- 1. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Java
Java
2018 2 8
- 2. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Oracle Java
2
- 3. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
:
"Java " : Java SE 8
"Java " : Java SE 9
: Oracle University
1
2
3
3
4
- 5. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
2020 IT
IT
IT IT
IT
IT
5
(1):
IT
: - IT (2016 6 )
IT
- 6. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 6
(2):
( )
: - IT (2016 6 ) : - IT (2016 6 )
IoT AI
- 7. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
(3):
IT
•
– IT SoE / SoI =
– SoR =
7
- 8. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
IT IT
IT
8
(4):
IT
: - IT (2016 6 )
5
IT
- 9. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Java SE 8
Java
9
- 10. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
1995 Sun Microsystems
( )
( TV )
10
- 11. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Java
TIOBE Programming Community Index
http://www.tiobe.com/tiobe-index/
PYPL: PopularitY of Programming Language
http://pypl.github.io/PYPL.html
15.0%
16.0%
16.5%
29.0%
17.5%
1.0%
26.5%
13.0%
4.5%
0.5%
41.5%
22.5%
10.0%
2.0%
0.5%
1.0%
6.5%
5.0%
2.5%
16.5%
12.5%
15.0%
18.5%
28.0%
7.0%
2.0%
15.5%
9.0%
5.0%
0.0%
47.5%
21.0%
10.5%
2.5%
1.5%
1.5%
0.0%
17.5%
0.5%
11.0%
0% 10% 20% 30% 40% 50%
C
C++
C#
VB.NET
Visual Basic 6.0
Objective-C
COBOL
PL/SQL
ABAP
Fortran
Java
JavaScript
PHP
Perl
Python
Ruby
HTML4
HTML5
N=200
(2013 )
11
- 12. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Java
Java
12
• Java Oracle JDK
• = Public Update
- 13. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 13
Java SE
• 1996
• Java
• 1998
• Collections
• 2002
• JCP
• 2006
• JVMTI
• 2014
• Lambda
• 1997
• JDBC
• 2000
• HotSpot
• 2004
• Generics
• 2011
• Oracle
• 2017/9/21 GA
1.0 1.2
1.1 1.3
1.4
5.0
6
7
8
9
- 15. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
0
10
20
30
40
50
60
70
Java
static
Oracle Certified Java Programmer, Bronze SE 7
Java 58.5
57.8
58.5
38.2
45.9
49.2
25.6
38.6
33.8
static 26.8
47.8
60.8
15
≠
2015
: 2015 6
: 12 /772
: Oracle Certified Java Programmer, Bronze SE 7
/ : 20 /20
- 16. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
•
•
•
–
•
–
new
•
–
16
- 1
1. List<Employee> employeeList = new ArrayList<>();
2. employeeList = EmployeeContainer.getList();
3. String name = "";
4. name = employee.getName();
1. List<Employee> employeeList =
EmployeeContainer.getList();
2. String name = empoyee.getName();
- 17. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
•
–
•
•
–
• ( )
–
17
:
•
–
•
•
–
• (= )
→
•
→
- 18. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
• •
– Item
(setter/getter)
•
–
•
•
18
- 2
1. public class Main {
2. public void method(Item item) {
3. int value = item.getAmount();
4. item.setAmount(value + 1);
5. }
6. }
7. public class Item {
8. private int amount;
9. public void setAmount(int amount) {
10. this.amount = amount;
11. }
12. public int getAmount() {
13. return amount;
14. }
15. }
Item
- 19. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
• •
–
Item
19
1. public class Main {
2. public void method(Item item) {
3. item.addAmount(1);
4. }
5. }
6. public class Item {
7. private int amount;
8. public void addAmount(int value) {
9. amount = amount + 1;
10. }
11. } Tips:
- 20. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
- 3
• + StringBuilder::append
• StringBuffer
20
1. StringBuilder sb = new StringBuilder();
2. sb.append("[" + str + "]");
• String +
String StringBuilder::append
• StringBuffer::append synchronized StringBuilder
- 21. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
StringBuilder::append
• StringBuilder::append
21
1. StringBuilder sb = new StringBuilder();
2. sb.append("[");
3. sb.append(str);
4. sb.append("]");
• StringBuffer::append
→ + StringBuilder …
• StringBuilder::new
- 22. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
•
– JDK ( )
–
# Japanese imperial calendar
#
# Meiji since 1868-01-01 00:00:00 local time (Gregorian)
# Taisho since 1912-07-30 00:00:00 local time (Gregorian)
# Showa since 1926-12-25 00:00:00 local time (Gregorian)
# Heisei since 1989-01-08 00:00:00 local time (Gregorian)
# NewEra since 2019-05-01 00:00:00 local time (Gregorian)
calendar.japanese.type: LocalGregorianCalendar
calendar.japanese.eras: ¥
name=Meiji,abbr=M,since=-3218832000000; ¥
name=Taisho,abbr=T,since=-1812153600000; ¥
name=Showa,abbr=S,since=-1357603200000; ¥
name=Heisei,abbr=H,since=600220800000; ¥
name=NewEra,abbr=NE,since=1556636400000
Tips: (Java SE 6 )
$JAVA_HOME/jre/lib/calendars.properties
*1
calendars.properties
*1 JDK 9 calendars.properties
" -Djdk.calendar.japanese.supplemental.era="name=NewEra,abbr=NE,since=1556636400000""
22
- 24. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
: Java SE 8
• Java SE 5 (2004.5 )
– BigDecimal
– (Generics)
– (Annotation)
– (enum) for
– Unicode 4.0
– JAR (Pack200)
• Java SE 7 (2011.7)
– Project Coin (JSR 334)
– InvokeDynamic (JSR 292)
– NIO.2 (JSR 203)
– JDBC 4.1
– Fork-Join (JSR
166y)
– JAXP, JAXB, JAX-WS
– JavaFX 2.0
– ClassLoader
– G1GC
• Java SE 6 (2006.12)
– AWT Swing
– JDBC 4.0
– JAXP (Java API for XML Processing)
1.4
– Executors
(JSR166)
– Web
– Windows
– Windows Aero
– Unicode
(java.text.Normalizer)
• Java SE 8 (2014.3)
– Project Lambda
• (JSR 335)
• Stream API
– Type Annotation (JSR 308)
– Date and Time API (JSR 310)
– JavaScript (Nashorn)
– JavaFX 8
– Hotspot JRockit
24
- 25. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
1. public class PriceTest {
2. public static void main(String... args) {
3. PriceTest test = new PriceTest();
4. System.out.println(" : "
+ test.calcPrice(1000, 0.07));
5.
6. }
7.
8. public int calcPrice(int l, double d) {
9. int p = (int) (l * (1 - d));
10. return p;
11. }
12.}
:
1,000
0.07
930
- 4
= * (1 - )
int double
25
- 26. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
- 4
BigDecimal …
1. public class PriceTest {
2. public static void main(String... args) {
3. PriceTest test = new PriceTest();
4. System.out.println(" : " + test.calcPrice(1000, 0.07));
5. }
6.
7. public int calcPrice(int l, double d) {
8. BigDecimal discount = new BigDecimal(d);
9. int p = BigDecimal.ONE.subtract(discount).multiply(BigDecimal.valueOf(l))
10. .setScale(0, RoundingMode.FLOOR).intValue();
11. return p;
12. }
13.}
26
BigDecimal(double)
:
new BigDecimal(0.1) → 0.1000000000000000055511151231257827021181583404541015625
- 27. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
BigDecimal
1. public class PriceTest {
2. public static void main(String... args) {
3. PriceTest test = new PriceTest();
4. System.out.println(" : " + test.calcPrice(1000, "0.07"));
5. }
6.
7. public int calcPrice(int l, String d) {
8. BigDecimal discount = new BigDecimal(d);
9. int p = BigDecimal.ONE.subtract(discount).multiply(BigDecimal.valueOf(l))
10. .setScale(0, RoundingMode.FLOOR).intValue();
11. return p;
12. }
13.}
BigDecimal
27
BigDecimal
BigDecimal
=
- 28. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
1. private List fileToList(String fileName) throws Exception {
2. String line;
3. List lines = new ArrayList();
4. BufferedReader reader = null;
5. try {
6. reader = new BufferedReader(new FileReader(fileName));
7. while((line = reader.readLine()) != null) {
8. lines.add(line);
9. }
10. reader.close();
11. } catch(Exception e) {
12. throw new CustomException();
13. }
14. return lines;
15.}
28
: J2SE 1.4 …
- 5
…
( → )
(→ )
reader close
- 29. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
1. private List<String> fileToList(String fileName) throws CustomSystemException {
2. List<String> lines = new ArrayList<String>();
3. BufferedReader reader = null;
4. try {
5. reader = new BufferedReader(new FileReader(fileName));
6. String line = null;
7. while(reader.readLine() != null) {
8. lines.add(line);
9. }
10. } catch (FileNotFoundException e) {
11. throw new CustomSystemException(FILE_NOT_FOUND, e);
12. } catch(IOException e) {
13. throw new CustomSystemException(FILE_READ_ERROR, e);
14. } finally {
15. try {
16. if (reader != null) reader.close();
17. } catch(IOException e) {
18. System.out.println("ERROR at closing Reader: " + e.getMessage());
19. }
20. }
21. return lines;
22. }
29
- 5
try-catch finally
(→ )
: Java SE 6 …
- 30. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
: Java SE 7
1. private List<String> fileToList(String fileName) throws CustomException {
2. List<String> lines = new ArrayList<>();
3. try(BufferedReader reader = new BufferedReader(new FileReader(filename))) {
4. String line;
5. while((line = reader.readLine()) != null) {
6. lines.add(line);
7. }
8. } catch(FileNotFoundException e) {
9. throw new CustomException(FILE_NOT_FOUND, e);
10. } catch(IOException e) {
11. throw new CustomException(FILE_READ_ERROR,e);
12. }
13. return lines;
14.}
+ ( )
try-with-resources
( → API )
30
Java
=
- 31. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
try-with-resources• JSR 334: Project Coin
1. Switch String
2. Multi-catch
3. try-with-resrouces
4.
5.
31
: Java SE 7
class MyResource implements java.lang.AutoCloseable {
@Override
public void close() throws Exception {
// ...
}
}
try (MyRecourse r1 = new MyResrouce();
MyResource r2 = new MyResoruce() ) {
// ...
} catch(MyException1 | MyException2 e) {
e.printStackTrace();
}
Reader/Writer File I/O API JDBC API (Java SE 7 )
Stream API (Java SE 8) AutoCloseable
( )
catch
(Multi-catch)
- 32. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
API
: Java SE 7 NIO.2
1. private List<String> readFile(String fileName) {
2. try {
3. return Files.readAllLines(Paths.get(fileName), Charset.defaultCharset());
4. } catch (IOException e) {
5. throw new SytemException(FILE_READ_ERROR, e);
6. }
7. }
32
Java SE 7 NIO.2 API
=
•
•
- 33. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
•
•
•
–
•
–
•
– ( )
•
• Strategy
33
- 6
1. public String evaluate(int score) {
2. if (score > 80) {
3. return "A";
4. } else {
5. if (score > 60) return "B";
6. else return "C";
7. }
8. }
1. public String evaluate(int score) {
2. if (score > 80) return "A";
3. if (score > 60) return "B";
4. return "C";
5. }
- 34. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
• • (Strategy )
34
- 6
1. public class Calculator {
2. public static final int ADDITION = 1;
3. public static final int SUBSTRACTION = 2;
4. private int type;
5. public Calculator(int type) {
6. this.type = type;
7. }
8. public int calculate(int a, int b) {
9. int result = 0;
10. if (type == ADDITION) {
11. result = a + b;
12. } else if (type == SUBSTRACTION) {
13. result = a - b;
14. }
15. return result;
16. }
17. }
1. public class Calculator {
2. private Type type;
3. public Calculator(Type type) {
4. this.type = type;
5. }
6. public int calculate(int a, int b) {
7. int result = type.execute(a, b);
8. return result;
9. }
10. }
11. public interface Type {
12. int execute(int a, int b);
13. }
14. public class Addition implements Type {
15. public int execute(int a, int b) {
16. return a + b;
17. }
18. }
19. public class Substraction implements Type {
20. public int execute(int a, int b) {
21. return a - b;
22. }
23. }
Type
if
- 35. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
• Java SE 8 … •
35
1. public class Calculator {
2. public int calculate(int a, int b, Type type) {
3. return type.execute(a, b);
4. }
5. }
6. @FunctionalInterface
7. interface Type {
8. int execute(int a, int b);
9. }
1. Calculator calc = new Calculator();
2. System.out.println(
calc.calculate(3, 1, (m, n) -> m + n ));
3. System.out.println(
calc.calculate(3, 1, (m, n) -> m - n ));
Type SAM
Type
- 36. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
: Java SE 8
in Java
• (Functional Programming) is …
• is …
• Java :
– Java SE 8
• API ( )
(Collection::removeIf List::replaceAll )
• API (Stream API)
36
( )
- 37. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
• • …
37
is -
1. public class Calc {
2. private int x; //
3. public int multiply(int a, int b) {
4. return a * b;
5. }
6. }
1. public class Calc {
2. private int x;
3. public int multiply(int y) {
4. return x *= y; //
5. }
6. }
⭕
⭕
❌
❌
- 38. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
for (String data : list) {
if (data.contains("c")) {
System.out.println(data);
}
}
list.stream()
.filter(data -> data.contains("c"))
.forEach(System.out::print);
-
List<String> list = Arrays.asList("abc", "bcd", "cde", "def", "efg");
( ):
=
(Java SE 8 ):
= API
38
( )
1.
2.
3.
1.
- 39. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
• ( )
–
–
• Java ( )
• =
–
– Java SE 8 API (java.util.function )
39
list.stream().filter(data -> data.contains("c")).forEach(System.out::print);
- 40. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Arrays.sort(array, new Comparator<String>(){
@Override
public int compare(String a, String b) {
return b.compareToIgnoreCase(a);
}
} );
System.out.println(
Arrays.deepToString(array));
Arrays.sort(array,
(a, b) -> b.compareToIgnoreCase(a) );
System.out.println(
Arrays.deepToString(array));
40
(java.util.Comparator )
String[] array = {"Java", "Candy", "Oracle", "Duke"};
(Java SE 8)
Java SE 8 java.util.Comparator
•
→
• a b
→ a b ( OK)
- 41. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Stream API
• API ( )
– ( )
– ( )
•
41
Stream
(Initiate) (Process) (Operate)
Stream.of()
Arrays.stream(T)
Collection.stream()
…
forEach()
reduce()
collect()
max(),min(),average()
count(),sum()
…
filter()
map()
flatMap()
peek()
…
- 42. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
: in Java
• Java SE 8
–
• OK
–
–
–
–
• Collection Stream API
–
– API
• Java
42
- 43. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
•
–Java
–
•
–
43
- 44. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Java SE 9
Java
44
- 45. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Java SE 9
2017 9 21
45
- 46. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Java SE 9
• …
–
• …
–
– Module System !
•
• JDK
46
- 47. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Java SE 9
BehindthescenesNewfunctionality
SpecializedNewstandards
HousekeepingGone
• Store Interned Strings in CDS Archives
• Improve Contended Locking
• Compact Strings
• Improve Secure Application Performance
• Leverage CPU Instructions for GHASH and RSA
• Tiered Attribution for javac
• Javadoc Search
• Marlin Graphics Renderer
• HiDPI Graphics on Windows and Linux
• Enable GTK 3 on Linux
• Update JavaFX/Media to Newer Version of GStreamer
• Jigsaw –Modularize JDK
• Enhanced Deprecation
• Stack-Walking API
• Convenience Factory Methods for Collections
• Platform Logging API and Service
• jshell: The Java Shell (Read-Eval-Print Loop)
• Compile for Older Platform Versions
• Multi-Release JAR Files
• Platform-Specific Desktop Features
• TIFF Image I/O
• Multi-Resolution Images
• Process API Updates
• Variable Handles
• Spin-Wait Hints
• Dynamic Linking of Language-Defined Object Models
• Enhanced Method Handles
• More Concurrency Updates
• Compiler Control
• HTTP 2 Client
• Unicode 8.0
• UTF-8 Property Files
• Implement Selected ECMAScript 6 Features in Nashorn
• Datagram Transport Layer Security (DTLS)
• OCSP Stapling for TLS
• TLS Application-Layer Protocol Negotiation Extension
• SHA-3 Hash Algorithms
• DRBG-Based SecureRandom Implementations
• Create PKCS12 Keystores by Default
• Merge Selected Xerces 2.11.0 Updates into JAXP
• XML Catalogs
• HarfBuzz Font-Layout Engine
• HTML5 Javadoc
• Parser API for Nashorn
• Prepare JavaFX UI Controls & CSS APIs for Modularization
• Modular Java Application Packaging
• New Version-String Scheme
• Reserved Stack Areas for Critical Sections
• Segmented Code Cache
• Ahead-of-Time Compilation
• Indify String Concatenation
• Unified JVM Logging
• Unified GC Logging
• Make G1 the Default Garbage Collector
• Use CLDR Locale Data by Default
• Validate JVM Command-Line Flag Arguments
• Java-Level JVM Compiler Interface
• Disable SHA-1 Certificates
• Simplified Doclet API
• Deprecate the Applet API
• Process Import Statements Correctly
• Annotations Pipeline 2.0
• Elide Deprecation Warnings on Import Statements
• Milling Project Coin
• Filter Incoming Serialization Data
• Remove GC Combinations Deprecated in JDK 8
• Remove Launch-Time JRE Version Selection
• Remove the JVM TI hprof Agent
• Remove the jhat Tool
JDK 9
/
JDK 9
47
- 48. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
• Module System (Jigsaw)
Module System (Jigsaw)
p
p
public
( )
Module
public ≠
(=
) JRE
48
• JEP (JDK Enhancement Proposal)
– JEP 261: Module System
– JEP 200: The Modular JDK
– JEP 201: Modular Source Code
– JEP 220: Modular Run-Time Images
– Plus
• JEP 260: Encapsulate Most Internal APIs
• JEP 282: jlink: The Java Linker
- 49. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
JEP 213: Milling Project Coin
• Project Coin (JEP 334)
– private @SafeVarargs
• @SafeVarargs final , static , + private
– try-with-resources final
–
– ("_")
• Java SE 9
– private
• (Java SE 8)
49
- 50. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
REPL (Read Eval Print Loop) for Java
•
•
JShell (JEP 222)
Read Eval)
(Print) (Loop)
50
- 51. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
JDK/JRE
51
- 52. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
JDK/JRE:
• tools.jar(JDK) rt.jar(JRE)
• Extension (JEP 261)
– java.ext.dirs
– lib/ext
• Endorsed Standards Override
– java.endorsed.dirs
– lib/endorsed
• lib/applets
52
- 53. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
• MetaSpace
–
• Native Memory
• Permanent
• OutOfMemoryError
–
– -XX:MaxMetaspaceSize=<NNN>
: Java SE 8 JVM
Thread
Stack
Permanent
-XX: MaxPermSize
Eden
Survivor0
Survivor1
Old
Java Permanent NativeJava
C Heap
C Heap
Thread
Stack
Eden
Survivor0
Survivor1
Old
Java Native
n HotSpot (Java SE 7)
n HotRockit (Java SE 8)
(static Java )
• JVM (Java SE 8)
– HotSpot VM JRockit VM
(HotRockit)
MetaSpace (GC )
-Xloggc:<FILE> -XX:+PrintHeapAtGC -XX:+PrintGCDetails
(JDK 9 )
-Xlog:gc*,gc+heap=trace:file=<FILE>
53
- 54. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
• Garbage Collection
– JVM
• GC
– Stop the World
• GC
– GC
– GC*
– GC (CMS)
JEP 248: Make G1 the Default Garbage Collector
• G1GC(Java SE 7 )
–
GC
• Region
• Region GC (Young GC Mixed GC)
– GC (-XX:MaxGCPauseMillis)
• JDK 9 (JEP248)
Stop the World (Full GC)
Eden
Survivor0
Survivor1
Old Perm
O
O
S
S
E
E
S
E
OO
O
S
ES
E
H
S
E
E
54
*64bit OS ( JDK8)
- 55. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
JEP 214: Remove GC Combinations Deprecated in JDK 8
• JDK 8 GC (JEP 173)
–
55
• DefNew + CMS : -XX:-UseParNewGC -XX:+UseConcMarkSweepGC
• ParNew + SerialOld : -XX:+UseParNewGC
• ParNew + iCMS : -Xincgc
• ParNew + iCMS : -XX:+CMSIncrementalMode -XX:+UseConcMarkSweepGC
• DefNew + iCMS : -XX:+CMSIncrementalMode -XX:+UseConcMarkSweepGC -XX:-UseParNewGC
• CMS foreground : -XX:+UseCMSCompactAtFullCollection
• CMS foreground : -XX:+CMSFullGCsBeforeCompaction
• CMS foreground : -XX:+UseCMSCollectionPassing
Point:
Perm (-XX:PermSize, -XX:MaxPermSize) JDK 9
- 56. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
JVM/GC
• Unified JVM Logging (JEP 158), Unified GC Logging (JEP 271)
– "–Xlog"
• -Xlog → -Xlog:all=warning:stdout:uptime,level,tags
– GC "-Xlog:gc"
56
JDK8 JDK9
PrintGC -Xlog:gc
PrintGCDetails -Xlog:gc*
PrintHeapAtGC -Xlog:gc+heap=trace
G1PrintHeapRegions -Xlog:gc+region=trace
-Xlog:[<selection>]:[<output>]:[<decorators>]
- 57. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
• JRE
(JEP 231)
– java –version:
• "-version"
– jar Manifest
JRE-Version
• 32bit Client JVM
– 32 bit Windows Client VM
Server VM
JVM
57
Server VM Client VM
• TieredStopAtLeve 1 (C1 JIT )
• Compilation threshold
( : 10,000 -> 1,000)
• Code cache
• G1GC ParallelGC
- 58. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
API
API
58
- 59. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
JEP 260: Encapsulate Most Internal APIs
• API
– API (Critical APIs)
•
– -jdkinternals jdeps
•
– java.lang.IllegalAccessException
•
– API
– : API ( )
59
- 60. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
• Applet API (JEP289)
–
@Deprecated(since="9")
• java.applet.AppletStub
• java.applet.Applet
• java.applet.AudioClip
• java.applet.AppletContext
• javax.swing.Japplet
– ("forRemoval=true")
• Java Plugin
– Java
Java
–
• IE Safari
– Netscape plugin API (NPAPI)
60
Applet
- 61. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
API -
• (JEP 223)
– java –version
–
• java.runtime.version, java.vm.version, java.specification.version, java.vm.specification.version
• CLDR (Common Local Data Repository) Locale Data (JEP 252)
– JDK9
• java.locale.providers=CLDR, COMPAT, SPI
–
• Java SE 8 java.locale.providers=COMPAT,SPI
61
JDK8: 1.$MAJOR.0_$MINOR-b$BUILD
JDK9: $MAJOR.$MINOR.$SECURITY+$BUILD
- 62. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
API -
• JEP 226: UTF-8 Property Files
– UTF-8
– ResourceBundle UTF-8 (JDK8 Latin-1)
– native2ascii
• java.policy (conf/security/java.policy)
– untrusted code Thread.stop()
• permission java.lang.RuntimePermission "stopThread";
62
- 63. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
JEP 182:
Policy for Retiring javac -source and -target Options
• javac -source, -target
"current + three back"
–
63
Java SE 8 Java SE 5
JDK 9 9/1.9 + 8/1.8, 7/1.7, 6/1.6
--release (JEP 247)
→ : 9 ( ), 8, 7, 6
6
javac --release N
javac -source N -target N -bootclasspath=/path/to/N/rt.jar
- 64. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
• JavaDB (Apache Derby )
• JVM TI hprof
• jhat
• RMI CGI (java-rmi.exe java-rmi.cgi)
• JMX RMIConnector IIOP
• Windows 32bit Client VM
• VisualVM (NetBeans profiler )
• native2ascii
64
- 65. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Java SE 9
65
- 66. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Java SE
• : 6
–
– 2018 3
• (LTS): 3
–
– 2018 9
• : 3 (1 , 4 , 7 , 10 )
–
•
– $YEAR.$MONTH (18.3, 18.9, ...)
66
Mark Reinhold’s Blog ( https://mreinhold.org/blog/forward-faster )
- 67. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 67
Java SE
Version Release
End of Public
Update
Extended Support
5 2004 5 2009 10 2015 5
6 2006 12 2013 2 2018 12
7 2011 7 2015 4 2022 7
8 2014 3 2019 1 * 2025 3
9 2017 9 2018 3 n/a
10(18.3) 2018 3 2018 9 n/a
11(18.9-LTS) 2018 9 ? 2026 9
Oracle Java SE Support Roadmap: http://www.oracle.com/technetwork/java/eol-135779.html
Java SE 9 10 (18.3)
Short Term Release
• 2020 12
Java SE 8 Java Web Start
2018/1/26
- 68. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Beyond Java SE 9
• Java SE 10 (18.3)
– JEP 286: Local-Variable Type Interface (Project Amber)
•
– JEP 305: Pattern Matching
• switch
68
var list = new ArrayList<String>(); // infers ArrayList<String>
var stream = list.stream(); // infers Stream<String>
String formatted;
switch (obj) {
case Integer i: formatted = String.format("int %d", i); break;
case Byte b: formatted = String.format("byte %d", b); break;
case Long l: formatted = String.format("long %d", l); break;
case Double d: formatted = String.format(“double %f", d); break;
case String s: formatted = String.format("String %s", s); break;
default: formatted = obj.toString();
}
if switch
- 69. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
•
–Java SE 9
• Module System
–JVM
–Java …
•
69
- 70. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Oracle University
70
- 71. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
(Java / Middleware)
- -
( )
(JVM / )(Java SE / EE)
Java SE 7/8
I
(3 )
Java SE 7/8
II
(3 )
Java EE 6
(5 )
Java EE 7: Web
(5 )
Java
(3 )
Oracle WebLogic Server
12c:
(2 )
Oracle WebLogic Server
12c: I (5 )
Java EE
(5 )
UML
/
for Java (3 )
Java SE 7 New Features
(2 )
Java SE 8
(2 )
UNIX/Linux
(3 )
Web
(3 )
Java EE 7
(2 )
Java EE 7: Back-end Server
Application Development
(5 )
Oracle Database 12c:
SQL I
(3 )
71
Java
(3 )
- 72. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
!!
(1)
Java
Java
UML
Java SE 7/8 I
§ Java
§ Java
§ 1
ü
ü
ü
ü static static
§ 2
ü
ü
ü
ü
§
§ java.lang
§ UML
ü Composite / Factory Method / Strategy /
Singleton / Adapter / Builder / Visitor /
Observer / Command / Façade
ü UML ( ,
, )
• Java for
• Java SE 7/8 I ( )
72
1
2 UML
Java SE 7
I
- 73. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
(2)
73
Java SE 8
Java SE 8
Stream API Data and Time API
§ Java SE 8
§
§
§
§
§
§ Stream
§
§
§ Date and Time API :
§ Date and Time API :
§ Date and Time API :
§ Nashorn Java JavaScript:
§ Nashorn Java JavaScript: JavaScript
§ Nashorn Java JavaScript: JavaScript JavaFX
§ Mission Control
§ Flight Recorder
• Java SE 7/8 I
• Java SE 7/8 II ( )
!!
- 74. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
(3)
Java
Java SE 7 G1 GC
JVM Java Flight Recorder Java Mission Control
§
§
§ G1 GC
§ JVM
§ Java Flight Recorder Mission Control
§
§
§
• Java SE 7/8 I
• Java SE 7/8 II ( )
74
!!
- 75. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Java
Oracle Java
( Java )
Gold API, I/O, JDBC
Java SE 8 Lambda Stream API
(Global : Oracle Certified Professional, Java SE 8 Programmer)
( Java )
Silver Java (
)
Lambda Date and Time API
(Global : Oracle Certified Associate, Java SE 8 Programmer)
Java
( )
Bronze Java ( )
Java
Oracle Certified
Java Programmer,
Gold SE 8
Oracle Certified
Java Programmer,
Silver SE 8
Oracle Certified
Java Programmer,
Bronze SE 7/8
Oracle Java Java
• Java SE
• Bronze, Silver, Gold
• *
* Silver/Gold Global Bronze
75
- 76. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
1
2013 3 2
Oracle Java
#1 IT - (2016 )
x2
98%
Java SE Java SE 7/ 8 (2016 )
OCJP Gold
Java
Java
Java
76
- 77. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
•
•
• : 2017 12 2 2018 5 31
• :
RETAKE18JP
•
VUE Web
77
- 78. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
– : RETAKE18JP
– : *
– : 2017 12 4 2018 5 31
• 1
• 2 2017 7 15
• 2
78
*
ORACLE MASTER Platinum Java EE Enterprise Architect
11gOCM, 11gOCMU, 12cOCM, 12cOCMU, 1Z0-866,1Z0-866-JPN, 1Z0-865, 1Z0-867
- 79. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
•
• Oracle Database (ORACLE MASTER)
– Bronze DBA 12c (1Z0-065)
– Oracle Database 12c: Administration (1Z0-062)
– Oracle Database 12c: Advanced Administration (1Z0-063)
• PaaS (ORCLE MASTER Cloud)
– Oracle Database Cloud Service (1Z0-160)
– Oracle Java Cloud Service(1Z0-161)
• Oracle Solaris
Upgrade to Oracle Solaris 11 System Administrator (1Z0-820)
Oracle Solaris 11 System Administration (1Z0-821)
Oracle Solaris 11 Advanced System Administration (1Z0-822)
79
• Java SE
– Java SE 8 Programmer I (1Z0-808)
– Java SE 8 Programmer II (1Z0-809)
– Upgrade Java SE 7 to Java SE 8 OCP Programmer (1Z0-810)
– Upgrade to Java SE 8 OCP ( Java SE 6 and all prior versions) (1Z0-813)
• Oracle WebLogic Server
– Oracle WebLogic Server 12c: Administration I (1Z0-133)
• MySQL
– MySQL 5.6 Developer (1Z0-882)
– MySQL 5.6 Database Administrator (1Z0-883)