Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Java13/Examples"
Line 13: | Line 13: | ||
! style="width: 25%;" | Expected Result | ! style="width: 25%;" | Expected Result | ||
|- | |- | ||
− | ! colspan="3" | The Pre-requisite: Java | + | ! colspan="3" | The Pre-requisite: Java 13 JRE Support |
|- | |- | ||
− | ! scope="row" | Add Java | + | ! scope="row" | Add Java 13 JRE |
| Use Window -> Preferences-> Java -> Installed JREs -> Add... <br> | | Use Window -> Preferences-> Java -> Installed JREs -> Add... <br> | ||
<br> | <br> | ||
Line 21: | Line 21: | ||
<br> | <br> | ||
[note: Eclipse -> Preferences in Mac / Window -> Preferences in Windows] | [note: Eclipse -> Preferences in Mac / Window -> Preferences in Windows] | ||
− | | Java | + | | Java 13 JRE recognized as a valid JRE |
|- | |- | ||
! scope="row" | Project JRE | ! scope="row" | Project JRE | ||
− | | In Package Explorer Use project's context menu and add Java | + | | In Package Explorer Use project's context menu and add Java 13 JRE || JRE specific (eg Object) gets resolved in the project. |
|- | |- | ||
! scope="row" | Package Explorer | ! scope="row" | Package Explorer | ||
− | | Go to Package Explorer and expand the Java | + | | Go to Package Explorer and expand the Java 13 JRE || Modules (eg java.base etc) are listed in the package explorer view |
|- | |- | ||
− | ! colspan="3" | The First Step: Java | + | ! colspan="3" | The First Step: Java 13 Compliance |
|- | |- | ||
! scope="row" | Set Project Compliance in Package Explorer | ! scope="row" | Set Project Compliance in Package Explorer | ||
− | | Context Menu of Project -> Properties -> Set project-specific, drop down to | + | | Context Menu of Project -> Properties -> Set project-specific, drop down to 13 |
<br> | <br> | ||
<br> | <br> | ||
[[File:j12.compliance.png]] | [[File:j12.compliance.png]] | ||
− | | | + | |13 is shown in the drop down list. |
A checkbox to enable preview features is available on the preference page. | A checkbox to enable preview features is available on the preference page. | ||
|- | |- | ||
Line 118: | Line 118: | ||
public String getDay_1 (Day today) { | public String getDay_1 (Day today) { | ||
String day = switch(today) { | String day = switch(today) { | ||
− | case MON, TUE, WED, THUR, FRI: | + | case MON, TUE, WED, THUR, FRI: yield "Weekday"; |
− | case SAT, SUN: | + | case SAT, SUN: yield "Weekend"; |
}; | }; | ||
return day; | return day; | ||
Line 142: | Line 142: | ||
public String getDay_1 (Day today) { | public String getDay_1 (Day today) { | ||
String day = switch(today) { | String day = switch(today) { | ||
− | case MON, TUE, WED, THUR, FRI: | + | case MON, TUE, WED, THUR, FRI: yield "Weekday"; |
− | case SAT, SUN: | + | case SAT, SUN: yield "Weekend"; |
}; | }; | ||
return day; | return day; | ||
Line 166: | Line 166: | ||
public String getDay_1 (Day today) { | public String getDay_1 (Day today) { | ||
String day = switch(today) { | String day = switch(today) { | ||
− | case MON : | + | case MON : yield "Weekday"; |
− | case SAT, SUN : | + | case SAT, SUN : yield "Weekend"; |
}; | }; | ||
return day; | return day; |
Revision as of 12:15, 7 September 2019
=======PAGE UNDER CONSTRUCTION==========
=======PAGE NOT UPDATED - PLACEHOLDER WITH JAVA 12 CONTENTS=====
This is an informal page listing examples of features that are implemented by the Java 13 Support. You are welcome to try out these examples. If you find bugs, please file a bug after checking for a duplicate entry here
NOTE:
- Switch expression, Enhanced switch statement and Multi-constant case labels are Preview features in Java 13. They are not enabled by default and can by enabled using --enable-preview.
- In Eclipse, --enable-preview can be enabled from the Preferences. It is implicitly added while launching a java program if the feature has been enabled for the project/workspace.