<label id="mms5m"></label>

    \" +\n\"\\n\\t\\t\" + \"

    \\\"Java 14 is here!\\\"<\/H1>\" +\n\"\\n\\t\" + \"<\/BODY>\" +\n\"\\n\" + \"<\/HTML>\";<\/pre>

    ??? ??? ???? ? ????? ???? ? ????. ??? ??? ?? ? ? ??? ?????? ???? ?? ??? ??? ??? ? ????. <\/p>

    String html = \"\"\"\n\n
    

    国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

    \n

    \"Java 14 is here!\"<\/H1>\n<\/BODY>\n<\/HTML>\"\"\";<\/pre>

    ??? ??? ?? ??? ????? ? ???? ?????. <\/p>

    Java 14?? ? ?? ??? ????? ???? ?????????. ??, ??? s ????? ???? ???? ??? ??? ? ????. ??, ????? ???? ? ?? ?? ??? ???? ?? ??? ? ????. ??? ?? ? ?? ??? ?? ??? ?? ?? ?? ??? ???? ?? ? ????. <\/p>

    ?? ??, ?? ?? ? ???? ???? ??? ??? ????. <\/p>

    String literal =\n\"Lorem ipsum dolor sit amet, consectetur adipiscing \" +\n\"elit, sed do eiusmod tempor incididunt ut labore \" +\n\"et dolore magna aliqua.\";<\/pre>

    ??? ???? ????? ???? ???? ??? ?? ??? ? ????. <\/p>

    String text = \"\"\"\nLorem ipsum dolor sit amet, consectetur adipiscing \\\nelit, sed do eiusmod tempor incididunt ut labore \\\net dolore magna aliqua.\\\n\"\"\";<\/pre>

    (??? ???? ?? ??: java ??? ???? <\/a>) <\/p>

    3. ????of? ?? ??<\/strong><\/p>

    Java 14?? ???? ??? ???? ?????? ?? ??? ?? ????? ??? ??? ??? ????. ?? ??, ?? ???<\/p>

    if (obj instanceof Group) {\nGroup group = (Group) obj;\n\/\/ use group specific methods\nvar entries = group.getEntries();\n}<\/pre>

    ? ???? ??? ???? ??? ?? ????? ? ????.<\/p>

    if (obj instanceof Group group) {\nvar entries = group.getEntries();\n}<\/pre>

    ??? ????? obj? Group ????? ??? obj? Group ??? ??? ???? ?? ??? ?????? ? ?? ?? ??? ?? ??? ?? ??? ?? ?? ??? ??? ? ????. <\/p>

    ??? ??? ??? Java ?????? ???? ???? ??? ? ????. <\/p>

    JEP 305? ? ?? ??? ???? Joshua Bloch? ?? \"Effective Java\"? ?? ???? ??? ?? ? ?? ??? ?? ??? ?????. <\/p>

    @Override public boolean equals(Object o) {\nreturn (o instanceof CaseInsensitiveString) &&\n((CaseInsensitiveString) o).s.equalsIgnoreCase(s);\n}<\/pre>

    ? ???? ??? CaseInsensitiveString ?????. ?? ??? ???? ???? ??? ? ????. ??: <\/p>

    @Override public boolean equals(Object o) {\nreturn (o instanceof CaseInsensitiveString cis) &&\ncis.s.equalsIgnoreCase(s);\n}<\/pre>

    ? ???? ??? ?? ???? ?? ??? ?? ?? ???? ??? ??? ? ??? ????. ?? ??? ????? ?? ??? ?? ???? ?? ??? ??? ? ?? ??? ??? ??? ???? ????. ??? ?? ???? ?? ???? ??? ???? ????? ?? ??? ????? ?? ??? ??? ?? instanceof ???? ?? ?????. <\/p>

    ?, ? ???? ??? ?? ??? ?????. ??? ? ??? ??? ? ?? ?? ??? ?? ?? ???? ?? ????. <\/p>

    4. ??<\/strong><\/p>

    ? ?? ???? ??? ?????. ?? ??? ?? ???? ??? ????? ? ???? ??? ???? Java ??? ??? ??? ??? ???? ?? ??? ??? ???? ? ??? ? ? ????. ???? ?? ??? ???? ?? ?????. ?? ??? ??? ?? ?? ?? ???? ???? ????. <\/p>

    ???? ??? ?? ??? ??? ???? BankTransaction? ?? ?? ?????. BankTransaction? ??? ???? ??, ??, ??? ? ?? ??? ?????. ???? ??? ? ???? ? ?? ??? ????: <\/p>

    Constructor, getter, ??? toString(), hashCode() ? equals() ??? ??? ??? ????? IDE? ?? ???? ???? ?? ??? ?????. ??? ?? BankTransaction ???? ??? ????. <\/p>

    public class BankTransaction {private final LocalDate date;\nprivate final double amount;\nprivate final String description;\npublic BankTransaction(final LocalDate date,\nfinal double amount,\nfinal String description) {\nthis.date = date;\nthis.amount = amount;\nthis.description = description;\n}\npublic LocalDate date() {\nreturn date;\n}\npublic double amount() {\nreturn amount;\n}\npublic String description() {\nreturn description;\n}\n@Override\npublic String toString() {\nreturn \"BankTransaction{\" +\n\"date=\" + date +\n\", amount=\" + amount +\n\", description='\" + description + '\\'' +\n'}';\n}\n@Override\npublic boolean equals(Object o) {\nif (this == o) return true;\nif (o == null || getClass() != o.getClass()) return false;\nBankTransaction that = (BankTransaction) o;\nreturn Double.compare(that.amount, amount) == 0 &&\ndate.equals(that.date) &&\ndescription.equals(that.description);\n}\n@Override\npublic int hashCode() {\nreturn Objects.hash(date, amount, description);\n}\n}<\/pre>

    Java 14? ??? ???? ???? ??? ?? ???? ???? ??? ?????. ? ???? ??? ??? ???? ??? ??? ????. Record? equals, hashCode ? toString ???? ??? ?????. ??? BankTransaction ???? ??? ?? ????? ? ????. <\/p>

    public record BankTransaction(LocalDate date,double amount,\nString description) {}<\/pre>

    ???? ?? ??? ? getter ???? ?? equals, hashCode ? toString? ??? \"????\" ??? ? ????. <\/p>

    ? ??? ????? ???? ???? ???? ??? ????? ???. <\/p>

    javac --enable-preview --release 14 BankTransaction.javarecord? ??? ????? ?????. ??? ??? ??? ?? ??? ? ????. ??? ??? ?? ???? ?? ?????? ?? ????? ????. ??? ??? ??? ?? ?????. <\/p>

    5. NullPointerException<\/strong><\/p>

    一些人認為,拋出NullPointerException異常應該當做新的“Hello World”程序來看待,因為NullPointerException是早晚會遇到的。玩笑歸玩笑,這個異常的確會造成困擾,因為它經(jīng)常出現(xiàn)在生產(chǎn)環(huán)境的日志中,會導致調試非常困難,因為它并不會顯示原始的代碼。例如,如下代碼:<\/p>

    var name = user.getLocation().getCity().getName();<\/pre>

    在Java 14之前,你可能會得到如下的錯誤:<\/p>

    Exception in thread \"main\" java.lang.NullPointerExceptionat NullPointerExample.main(NullPointerExample.java:5)<\/pre>

    不幸的是,如果在第5行是一個包含了多個方法調用的賦值語句(如getLocation()和getCity()),那么任何一個都可能會返回null。實際上,變量user也可能是null。因此,無法判斷是誰導致了NullPointerException。<\/p>

    在Java 14中,新的JVM特性可以顯示更詳細的診斷信息:<\/p>

    Exception in thread \"main\" java.lang.NullPointerException: Cannot invoke \"Location.getCity()\" because the return value of \"User.getLocation()\" is nullat NullPointerExample.main(NullPointerExample.java:5)<\/pre>

    該消息包含兩個明確的組成部分:<\/p>

    后果:Location.getCity()無法被調用原因:User.getLocation()的返回值為null增強版本的診斷信息只有在使用下述標志運行Java時才有效:<\/p>

    -XX:+ShowCodeDetailsInExceptionMessages<\/pre>

    下面是個例子:<\/p>

    java -XX:+ShowCodeDetailsInExceptionMessages NullPointerExample<\/pre>

    在以后的版本中,該選項可能會成為默認。
    <\/p>\n

    這項改進不僅對于方法調用有效,其他可能會導致NullPointerException的地方也有效,包括字段訪問、數(shù)組訪問、賦值等。<\/p>"}

    ? Java Java??? java14? ??? ??? ??????

    java14? ??? ??? ??????

    Jun 20, 2020 pm 01:33 PM
    ??

    java14? ??? ??? ??????

    1. ??? ??

    ?? ????? ??? ??? "?? ??" ????? ???????. "?? ??" ??? ?? ??? ??? ???? ???? ????. ??? ??? ???? ??? ? ??? ??? ??? ?? ??? ??? ??? ?? ??? ????? ?? ?? ?? ??? ????. ?? Java?? ??? ?????.

    (?? ????: Java ???? ????)

    ??? ??? ???? ??? ? ?? ?? ???? ??(fall-through)? ?? ? ????? ???? ??? ????? ? ??? ????. , ??? ??? ??? ???? ? ????. ?? ?? ??? ???? ?? ??? ?? ??? ??? ??? ? ????.

    var log = switch (event) {
    case PLAY -> "User has triggered the play button";
    case STOP, PAUSE -> "User needs a break";
    default -> {
    String message = event.toString();
    LocalDateTime now = LocalDateTime.now();
    yield "Unknown event " + message +
    " logged on " + now;
    }
    };

    2. ??? ??

    Java 13? ??? ?? ?? ?? ? ??? ??? ?????. ??? ??? ???? ?? ?? ??? ??? ???? ?? ??? ? ????. ? ??? Java 14?? ? ?? ?? ??? ???? ? ?? ?? ??? ????. ?? ??, ?? ? ???? ??? ????? ?? ??? ?? ??? ????? ???? ???? ? ? ????. ?? ??? HTML ?? ?????.

    String html = "<HTML>" +
    "\n\t" + "<BODY>" +
    "\n\t\t" + "<H1>\"Java 14 is here!\"</H1>" +
    "\n\t" + "</BODY>" +
    "\n" + "</HTML>";

    ??? ??? ???? ? ????? ???? ? ????. ??? ??? ?? ? ? ??? ?????? ???? ?? ??? ??? ??? ? ????.

    String html = """
    <HTML>
    <BODY>
    <H1>"Java 14 is here!"</H1>
    </BODY>
    </HTML>""";

    ??? ??? ?? ??? ????? ? ???? ?????.

    Java 14?? ? ?? ??? ????? ???? ?????????. ??, ??? s ????? ???? ???? ??? ??? ? ????. ??, ????? ???? ? ?? ?? ??? ???? ?? ??? ? ????. ??? ?? ? ?? ??? ?? ??? ?? ?? ?? ??? ???? ?? ? ????.

    ?? ??, ?? ?? ? ???? ???? ??? ??? ????.

    String literal =
    "Lorem ipsum dolor sit amet, consectetur adipiscing " +
    "elit, sed do eiusmod tempor incididunt ut labore " +
    "et dolore magna aliqua.";

    ??? ???? ????? ???? ???? ??? ?? ??? ? ????.

    String text = """
    Lorem ipsum dolor sit amet, consectetur adipiscing \
    elit, sed do eiusmod tempor incididunt ut labore \
    et dolore magna aliqua.\
    """;

    (??? ???? ?? ??: java ??? ???? )

    3. ????of? ?? ??

    Java 14?? ???? ??? ???? ?????? ?? ??? ?? ????? ??? ??? ??? ????. ?? ??, ?? ???

    if (obj instanceof Group) {
    Group group = (Group) obj;
    // use group specific methods
    var entries = group.getEntries();
    }

    ? ???? ??? ???? ??? ?? ????? ? ????.

    if (obj instanceof Group group) {
    var entries = group.getEntries();
    }

    ??? ????? obj? Group ????? ??? obj? Group ??? ??? ???? ?? ??? ?????? ? ?? ?? ??? ?? ??? ?? ??? ?? ?? ??? ??? ? ????.

    ??? ??? ??? Java ?????? ???? ???? ??? ? ????.

    JEP 305? ? ?? ??? ???? Joshua Bloch? ?? "Effective Java"? ?? ???? ??? ?? ? ?? ??? ?? ??? ?????.

    @Override public boolean equals(Object o) {
    return (o instanceof CaseInsensitiveString) &&
    ((CaseInsensitiveString) o).s.equalsIgnoreCase(s);
    }

    ? ???? ??? CaseInsensitiveString ?????. ?? ??? ???? ???? ??? ? ????. ??:

    @Override public boolean equals(Object o) {
    return (o instanceof CaseInsensitiveString cis) &&
    cis.s.equalsIgnoreCase(s);
    }

    ? ???? ??? ?? ???? ?? ??? ?? ?? ???? ??? ??? ? ??? ????. ?? ??? ????? ?? ??? ?? ???? ?? ??? ??? ? ?? ??? ??? ??? ???? ????. ??? ?? ???? ?? ???? ??? ???? ????? ?? ??? ????? ?? ??? ??? ?? instanceof ???? ?? ?????.

    ?, ? ???? ??? ?? ??? ?????. ??? ? ??? ??? ? ?? ?? ??? ?? ?? ???? ?? ????.

    4. ??

    ? ?? ???? ??? ?????. ?? ??? ?? ???? ??? ????? ? ???? ??? ???? Java ??? ??? ??? ??? ???? ?? ??? ??? ???? ? ??? ? ? ????. ???? ?? ??? ???? ?? ?????. ?? ??? ??? ?? ?? ?? ???? ???? ????.

    ???? ??? ?? ??? ??? ???? BankTransaction? ?? ?? ?????. BankTransaction? ??? ???? ??, ??, ??? ? ?? ??? ?????. ???? ??? ? ???? ? ?? ??? ????:

    Constructor, getter, ??? toString(), hashCode() ? equals() ??? ??? ??? ????? IDE? ?? ???? ???? ?? ??? ?????. ??? ?? BankTransaction ???? ??? ????.

    public class BankTransaction {private final LocalDate date;
    private final double amount;
    private final String description;
    public BankTransaction(final LocalDate date,
    final double amount,
    final String description) {
    this.date = date;
    this.amount = amount;
    this.description = description;
    }
    public LocalDate date() {
    return date;
    }
    public double amount() {
    return amount;
    }
    public String description() {
    return description;
    }
    @Override
    public String toString() {
    return "BankTransaction{" +
    "date=" + date +
    ", amount=" + amount +
    ", description=&#39;" + description + &#39;\&#39;&#39; +
    &#39;}&#39;;
    }
    @Override
    public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;
    BankTransaction that = (BankTransaction) o;
    return Double.compare(that.amount, amount) == 0 &&
    date.equals(that.date) &&
    description.equals(that.description);
    }
    @Override
    public int hashCode() {
    return Objects.hash(date, amount, description);
    }
    }

    Java 14? ??? ???? ???? ??? ?? ???? ???? ??? ?????. ? ???? ??? ??? ???? ??? ??? ????. Record? equals, hashCode ? toString ???? ??? ?????. ??? BankTransaction ???? ??? ?? ????? ? ????.

    public record BankTransaction(LocalDate date,double amount,
    String description) {}

    ???? ?? ??? ? getter ???? ?? equals, hashCode ? toString? ??? "????" ??? ? ????.

    ? ??? ????? ???? ???? ???? ??? ????? ???.

    javac --enable-preview --release 14 BankTransaction.javarecord? ??? ????? ?????. ??? ??? ??? ?? ??? ? ????. ??? ??? ?? ???? ?? ?????? ?? ????? ????. ??? ??? ??? ?? ?????.

    5. NullPointerException

    一些人認為,拋出NullPointerException異常應該當做新的“Hello World”程序來看待,因為NullPointerException是早晚會遇到的。玩笑歸玩笑,這個異常的確會造成困擾,因為它經(jīng)常出現(xiàn)在生產(chǎn)環(huán)境的日志中,會導致調試非常困難,因為它并不會顯示原始的代碼。例如,如下代碼:

    var name = user.getLocation().getCity().getName();

    在Java 14之前,你可能會得到如下的錯誤:

    Exception in thread "main" java.lang.NullPointerExceptionat NullPointerExample.main(NullPointerExample.java:5)

    不幸的是,如果在第5行是一個包含了多個方法調用的賦值語句(如getLocation()和getCity()),那么任何一個都可能會返回null。實際上,變量user也可能是null。因此,無法判斷是誰導致了NullPointerException。

    在Java 14中,新的JVM特性可以顯示更詳細的診斷信息:

    Exception in thread "main" java.lang.NullPointerException: Cannot invoke "Location.getCity()" because the return value of "User.getLocation()" is nullat NullPointerExample.main(NullPointerExample.java:5)

    該消息包含兩個明確的組成部分:

    后果:Location.getCity()無法被調用原因:User.getLocation()的返回值為null增強版本的診斷信息只有在使用下述標志運行Java時才有效:

    -XX:+ShowCodeDetailsInExceptionMessages

    下面是個例子:

    java -XX:+ShowCodeDetailsInExceptionMessages NullPointerExample

    在以后的版本中,該選項可能會成為默認。

    這項改進不僅對于方法調用有效,其他可能會導致NullPointerException的地方也有效,包括字段訪問、數(shù)組訪問、賦值等。

    ? ??? java14? ??? ??? ??????? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

    ? ????? ??
    ? ?? ??? ????? ???? ??? ??????, ???? ?????? ????. ? ???? ?? ???? ?? ??? ?? ????. ???? ??? ???? ???? ??? ?? admin@php.cn?? ?????.

    ? AI ??

    Undresser.AI Undress

    Undresser.AI Undress

    ???? ?? ??? ??? ?? AI ?? ?

    AI Clothes Remover

    AI Clothes Remover

    ???? ?? ???? ??? AI ?????.

    Video Face Swap

    Video Face Swap

    ??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

    ???

    ??? ??

    ???++7.3.1

    ???++7.3.1

    ???? ?? ?? ?? ???

    SublimeText3 ??? ??

    SublimeText3 ??? ??

    ??? ??, ???? ?? ????.

    ???? 13.0.1 ???

    ???? 13.0.1 ???

    ??? PHP ?? ?? ??

    ???? CS6

    ???? CS6

    ??? ? ?? ??

    SublimeText3 Mac ??

    SublimeText3 Mac ??

    ? ??? ?? ?? ?????(SublimeText3)

    ???

    ??? ??

    ??? ????
    1601
    29
    PHP ????
    1502
    276
    ???
    win7 ? ??? win7 ?? ??? ??? ?? win7 ? ??? win7 ?? ??? ??? ?? Jul 12, 2023 pm 08:41 PM

    Win7 Ultimate ??, Win7 Professional ??, Win7 Home ?? ?? ?? Win7 ??? ??? ??? ?? ??? ?? ????. ?? ???? Home ??? Ultimate ?? ???? ?? ?? ??? ???? ?? ????. ??? ??? Win7 Family Meal? Win7 Ultimate? ???? ?? ????????. 1. Different Home Basic Edition? ??? ???. ???? ??? ? ??? ???? ??? ?? ?? ???? ????? ??? ? ??? ???? ???? ? ????. Home Premium? ???? TV ????, ??, ??? ? ??? ?? ??? ??? ? ?? ??? ?????? ??? ?????. Ultimate Edition? ? ???? ?? ??? ???? Windows 7 Home Premium? ?? ?????? ??? ?? ??? ??? ????.

    Spring MVC? ?? ??? ?????: ??? ??? ??? ?????? Spring MVC? ?? ??? ?????: ??? ??? ??? ?????? Dec 29, 2023 am 09:14 AM

    SpringMVC? ?? ?? ??: ??? ??? ??? ???? ?? ?? ??? ?????. SpringMVC? ???? MVC(Model-View-Controller) ???? ??? ?? ???? ?? ??? ??? ???? ? ??? ?? Java ?? ? ?????? ?? ????????. ? ??????. SpringMVC? ?? ??? ???? ??? ? ??????? ?? ????? ???? ??? ? ????. ? ????? SpringMVC? ? ?? ??? ??? ?????.

    Golang? ???? ??? ???? ??? ???? Golang? ???? ??? ???? ??? ???? Mar 19, 2024 pm 02:51 PM

    Golang(Go ??)?? ???? ??? ??? ??? ???, ???? ??? ???? ??? ??? ? ?? ????? ??? ??? ?????. ? ????? ??? ???? ?? ?? ??? ???? ??? ???? ?? ?? ??? ?????. ??? ??? ??? ?? ??? ??? ???? ????. Golang??? type ???? ?? ??? ??? ?? ??? ?? ??? ? ????. ???? ??? ??? ? ????.

    ??? ??? ?? ?? Go ??? ?????. ??? ??? ?? ?? Go ??? ?????. Jan 20, 2024 am 09:28 AM

    ???? ??? ???? ????? ??? ???? ???? ?????? ????. ? ? ???? ????? ??? Go ??? ?? ? ?? ?? ??? ?? ????. Go ??? ???? ????? ???? ?? ? ??? ????? ???????. ?? ???, ?? ???, ??? ??? ?? ??? ?? ?? ? ??, ???? ???, ???? ? ???? ?? ?????. ??? ?? ??? ??? Go ??? ??? ? ????. ??? Go ?? ??? ??? ? ?? ??? ??? ?? ???? ???. ??

    5g? 3?? ??? ???? 5g? 3?? ??? ???? Dec 09, 2020 am 10:55 AM

    5G? ? ?? ??? ??? ????. 1. ??, ?? ?? ???? 5G ????? ??? 4G ????? 10? ?????. 2. ?? ?? ??: 5G ????? ?? ??? ? ?? ???? ??? ?? ???? ????. 3. ??? ???, 5G ????? ??? ?? ??? ???? ?????(Internet of Everything)? ??? ??? ??? ????.

    ??? ??? ???? ??? ??? ???? Aug 09, 2023 pm 03:05 PM

    Java? ??? ??? ????. 1. ???? ??? ????. 2. ??? ? ?? ????? ?? ??? ? ????. 3. ??? ????? ??? ?? ???? ?? ?????. 4. ?? ???? ?? ??? ?? ?? ???? ??? ?? 5. ??? ???? ?? ?? ??? ???? ???. 6. ?? ??? ?? ??? ? ??? ??? ? ?? ??. 8. ?? ??? ?? ???? ??? ??? ? ????. 9. ??? ?? ????? ? ????? 10. ?? ?? ???.

    C++ ?? ?? ? ?? C++ ?? ?? ? ?? Apr 11, 2024 pm 03:30 PM

    C++ ???? ?? ??, const ??, ?? ?? ? ?? ?? ??? ????. ???? ??? ??, ?? ????, ?? ?? ? ????? ??? ?????. ?? ??,calculateArea ??? π? ???? ??? ??? ?? ??? ???? ?? ???? ?????.

    ?? ???? ????? 5?? PHP8 ?? ??! ?? ???? ????? 5?? PHP8 ?? ??! Jan 13, 2024 am 08:19 AM

    ??? ?? ????? ??? PHP8? ?? ?? ?? ??! PHP(Hypertext Preprocessor)? ? ??? ?? ???? ?? ?? ???? ?????. ??? ?? HTML? ?? ???? ??? ? ??? ?? ?? ?????? ?????. ?? ??? PHP8?? ?? ???? ? ??? ?? ??? ???? ????. ??? ??? ?? ????? ?? ? ?? 5?? ?? ?????. 1. JIT ????(Just-In-TimeCompile

    See all articles