fork(1) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. System.out.println(
  13. Runtime.version().toString()
  14. );
  15.  
  16. Runtime.Version v = Runtime.version() ;
  17.  
  18. // Required parts.
  19. int feature = v.feature() ;
  20. int interim = v.interim() ;
  21. int update = v.update() ;
  22. int patch = v.patch() ;
  23.  
  24. // Optional parts.
  25. Optional<Integer> build = v.build() ;
  26. Optional<String> pre = v.pre() ;
  27. Optional<String> optional = v.optional() ;
  28.  
  29. System.out.println( "feature: " + feature ) ;
  30. System.out.println( "interim: " + interim ) ;
  31. System.out.println( "update: " + update ) ;
  32. System.out.println( "patch: " + patch ) ;
  33.  
  34. System.out.println( "build: " + build ) ;
  35. System.out.println( "pre: " + pre ) ;
  36. System.out.println( "optional: " + optional ) ;
  37. }
  38. }
Success #stdin #stdout 0.17s 51248KB
stdin
Standard input is empty
stdout
12.0.1+12
feature: 12
interim: 0
update: 1
patch: 0
build: Optional[12]
pre: Optional.empty
optional: Optional.empty