pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/ortolanph/Java10Examples

ub.githubassets.com/assets/primer-70be7debc79a8eff.css" /> GitHub - ortolanph/Java10Examples: Java JEP286 examples · GitHub
Skip to content

ortolanph/Java10Examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java 10 Examples

This project shows some examples on how to use the JEP286, the Local-Variable Type Inference, implemented on Java Version 10.

Basic examples:

It's possible to use on primitive types:

var i = 10; // It's an int

Refer to org.java10.examples.BasicExample class.

It's possible to use on Java API classes:

var hello = "Hello!";

Refer to org.java10.examples.ObjectExample class.

Complex example:

It's possible to build developed objects:

var Product = new Product("Good Laptop", 1000f, 10f);

Refer to org.java10.examples.ComplexObjectExample class.

Adding behaviour

It's possible to add a new method to existing class

var modifiedProduct = new Product("An internet product", 8f, 0.5f) {
    public float applyInternetPrice() {
        return getPrice() - 1f + getTax();
    }
};

Refer to org.java10.examples.ProductExample class.

Mixing interfaces

It's possible to mix interfaces.

var seaplane = (Navigable & Flyer) Vehicle::create;

Refer to org.java10.examples.MixinExample class.

Releases

No releases published

Packages

 
 
 

Contributors

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy