“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” (Mosher's Law of Software Engineering)
“If debugging is the process of removing bugs, then programming must be the process of putting them in.” (Edsger Dijkstra)
Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook | Java 11 Cookbook
John Todd wrote:I'm happy Java is moving but nothing caught my eyes in Java 7. invokedynamic is cool any way.
I hope Java 8 will bring much more exciting and important features to the table.
Maybe it is time to announce Scala programming language as the second official language on the JVM.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Augusto Sellhorn wrote:Just wanted to share my blog post on 7 features I think are cool in Java 7;
"7 new cool features in Java 7"
http://sellmic.com/blog/2011/07/08/7-new-cool-features-in-java-7/
But I was wondering if I had to pick one which it would be, and what everybody would chose.
I think for me it would have to be the multiple exception handling interface. I know it's not the most exciting thing, but I've been guilty of one of the things I criticize in my blog post which is using catch (Exception e) when I'm bothered by catching 5 different exceptions because I'm doing some reflection work.
So what's your favorite Java 7 feature?
OCPJP 6
"If the facts don't fit the theory, get new facts" --Albert Einstein
Good luck for yourself.
Stas Sokolov wrote:Try with resource might be a good thing but it can only work for system classes...
Paul Clapham wrote:
Stas Sokolov wrote:Try with resource might be a good thing but it can only work for system classes...
I don't see why. As far as I can tell it can work with anything which implements the AutoCloseable interface, and anybody can write code to do that. It wouldn't be surprising to find that the code you wrote three years ago doesn't implement AutoCloseable, but there isn't anything to prevent you from making it do that. Except of course for management requirements, which you can't blame Oracle for.
Good luck for yourself.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Good luck for yourself.
Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook | Java 11 Cookbook
2. Generic type inference handling is nice feature that I was long waiting for. But once said A why not to say B. Why not make it legal final x=""; or public b=true; It is clear from the context that x is a string and b is a boolean
SCJP
Visit my download page
Stas Sokolov wrote:Believe me or not I am fine about AutoCloseable interface. It would be no pain to implement it but I am not getting why it should be connected to try/catch block. AutoClose the class when no references left and we have all scores settled.
Whizlabs Support ([email protected] or +91-9971838640 )
OCAJP 8 | OCPJP 8 | OCEJWCD | OCMJEA
Vishal Baid wrote:
I don't think you get how to use try-with-resources. It would be something like the following:
...
Vishal Baid wrote:And the code you posted doesn't close the resources properly. If rs.close() would throw an IOException then the statement and the connection will not be closed.
Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook | Java 11 Cookbook
Mohamed Sanaulla wrote:
Vishal Baid wrote:
I don't think you get how to use try-with-resources. It would be something like the following:
...
How do you think is the code posted by you different from the one posted by Wouter? I see they both are same.
Vishal Baid wrote:And the code you posted doesn't close the resources properly. If rs.close() would throw an IOException then the statement and the connection will not be closed.
There is no close invoked in any of the two code samples. And the AutoCloseable takes care of this exception being thrown by rs.close().
In FInally block you neeed to close connection which we dnt require now.
And the code you posted doesn't close the resources properly. If rs.close() would throw an IOException then the statement and the connection will not be closed.
Campbell Ritchie wrote:Apart from the facility in Java7 (or Java7 fora) to copy the same post and for several people to post things identical . . .
How about List<String> words = new ArrayList<>();
Campbell Ritchie wrote:They have been promising to prohibit raw types in new code since before Java6.
[OCP 21 book] | [OCP 17 book] | [OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Campbell Ritchie wrote:Prohibiting raw types would have been nice. So would generics which people can actually understand.
Any sufficiently advanced technology will be used as a cat toy. And this tiny ad contains a very small cat:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|