aspose file tools*
The moose likes Features new in Java 7 and the fly likes What are your top 5 features that you love about Java 7? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Features new in Java 7
Bookmark "What are your top 5 features that you love about Java 7?" Watch "What are your top 5 features that you love about Java 7?" New topic
Author

What are your top 5 features that you love about Java 7?

arulk pillai
Author
Ranch Hand

Joined: May 31, 2007
Posts: 3220
If you have to list 5 best features of Java 7 that you wish you had a while ago what would that be?

Are there any pitfalls that you wished was addressed in Java 7?


Java Interview Questions and Answers Blog | Amazon.com profile | Java Interview Books
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

For me it's invokedynamic, Diamond Operator, try-with-resources, NIO.2 API and multi-catch. I was pretty happy with the scope of Java 7, invokedynamic will prove to be its most important feature going forwards....


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
SbhargavS Surimenu
Greenhorn

Joined: Mar 09, 2010
Posts: 4
For me

  • Resource releasing without having finally block
  • [list]switch case variables accepting the string literals
  • Allowing underscores in between digits. Numeric value is more readable when we use underscores in between (e.g. Debit card or credit card number is 16 digit so if you use underscore in between for every 4 digits
  • ).



    Regards,
    Bhargav

    Pat Farrell
    Rancher

    Joined: Aug 11, 2007
    Posts: 4659
        
        5

    SbhargavS Surimenu wrote:
  • switch case variables accepting the string literals


  • I can't understand why this wasn't in Java 1.1 or some other early release. Its so obvious. And strings are constants, why the delay?
    R. Jain
    Ranch Hand

    Joined: Aug 11, 2012
    Posts: 375
        
        1

    For me, it's Diamond Operator, Catch multiple Exceptions, Try with Resources, Switch with String literals, and InvokeDynamism
    Andrew Desmond
    Greenhorn

    Joined: Oct 25, 2012
    Posts: 1

    1. Switch with Strings
    2. Enhanced For loop
    3. Try with resources
    4. underscores between digits (I don't know how many times I've missed a zero when writing large numbers resulting in headaches later on)
    5. Diamond operator
    Martin Vajsar
    Sheriff

    Joined: Aug 22, 2010
    Posts: 3610
        
      60

    Andrew Desmond wrote:2. Enhanced For loop

    That one was actually introduced earlier, in Java 5 I believe. But if it was introduced in Java 7, it would be my favorite Java 7 feature by a wide margin.
    Esteban Herrera
    author
    Greenhorn

    Joined: Dec 25, 2004
    Posts: 21

    Pat Farrell wrote:I can't understand why this wasn't in Java 1.1 or some other early release. Its so obvious. And strings are constants, why the delay?


    Apparently because of performance. Here is a good explanation http://stackoverflow.com/questions/338206/switch-statement-with-strings-in-java

    My list:
    1. Resource management in try blocks
    2. Using strings in switch statements
    3. Numeric literals with underscores
    4. Multicatch blocks
    5. NIO 2.0 API
    Gowtham Gutha
    Greenhorn

    Joined: Oct 22, 2012
    Posts: 1
    NimbusLookAndFeel
    Rob Spoor
    Sheriff

    Joined: Oct 27, 2005
    Posts: 19697
        
      20

    That's been available for quite a while already.


    SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
    How To Ask Questions How To Answer Questions
    D Rog
    Ranch Hand

    Joined: Feb 07, 2004
    Posts: 472

    I put my thoughts with code examples http://www.infoq.com/articles/java7-nio2

    Quick recap:
    1. new file io giving control over modern file systems especially POSIX alike.
    2. Auto resources freeing
    3. Forks for easier parallel programming
    4. Switch with "String" cases (absolutely love it)
    5. <> for reducing typing efforts

    6. Just forgot variable arguments improvements giving me possibility to create generic arrays.

    I am spoiled by Java 7 and can't wait using Java 8 with default methods, enclousers and other bells and whistles. What about you?


    Retire your iPod and start with HD Android music player Kamerton | Minimal J2EE container is here | Light weight full J2EE stack | and build tool | Co-author of "Windows programming in Turbo Pascal"
    Abhay Agarwal
    Ranch Hand

    Joined: Feb 29, 2008
    Posts: 1106
        
        1

    Same here .. waiting for Java 8 release... just download intermediate version of Java 8 binaries ... waiting to know what features shall be included in Java 8...


    Oracle Java Web Service Developer (1z0-897), Oracle certified Java 7 Programmer, SCJA 1.0, SCJP 5.0, SCWCD 5.0, Oracle SQL Fundamentals I
     
    wood burning stoves
     
    subject: What are your top 5 features that you love about Java 7?