Java 12Java 12 release after the LTS version 11 of Java. JDK 12 is a part of the 6-month release cycle. On 19 March 2019, Java 12 was released, which is a Non-LTS version and would not have long term support. An open-source reference implementation of Java 12 SE Platform is referred to as Java 12. In JDK 12, production-ready binaries present in the GPL are available from Oracle, and other vendor's binaries will also follow shortly. In Java JDK 12, there are not so many features of API are added. Internal Java/JVM is the main enhancements in JDK 12. In JDK 12, a new feature, i.e., JEP, is added. These are the following features included in Java 12 as JEP:
We can use case L or break for returning a value from a switch in Java 12. case L -> syntax
Apart from these new features, in Java 12, 4 new string methods are added in which two are mostly used: indent(int n) The indent() method is used for adjusting the indentation of each line of the string. The adjustment is based on the argument passed to it. We can either pass negative or positive int as an argument for reducing the indentation of the string. Example by passing the positive integer as an argument to the function: Output: Example by passing negative integer as an argument to the function: Output: transform(Function f) The transform(Function f) is used to apply the specified function to that string. The specified function will accept only a single string value and return the object. Let's take an example to understand this method: TransformExample.java Output: Next TopicAssociation in Java |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India