Whenever, I am crawl through the web i notice the word java 7.Then,I really found out java 7 is today’s hot topic. So i googled it for know something about java 7.At that time i found out some thing interested and useful features in java 7.Thats push me here to share something to you all folks.Lets get into the topic.
The project name of java 7 development is Project Coin.I have listed some of the features below.
Null-safe Method invocation:
This is the greatest feature which is going to added in Java 7.NullPoniterException is one of the most common exception encountered in Java programming.
When I searched “NullPointerException” in Google, it gave about 5,570,000 results! This proves how pervasive the exception is and how much effort a developer has to put in writing java code free from null pointer exception.
Suppose if java has a feature to keep us in safe zone from null pointer exception, how is it? It happens.
Suppose we have a method to fetch postal code of a person’s address:
Now check the above syntax. We have done lots of if (null! = object) checks to avoid NullPointerException.
1
public String getPostcode(Person person)
2
{
3
return
person?.getAddress()?.getPostcode();
4
}
Null-ignore invocation is concerned with dealing with possible null values in calling one or especially a chain of methods. Check the syntax?. while calling method on an object. This is Null-safe operator in Java 7. Thus, you can avoid lots of if (null!= object) checks in Java 7.
Strings in Switch Statements:
Whenever i am working with switch-case i felt, if the case allowed the string as a case variable we feel so comfort on that. Because the switch case allows only the primitive data types as variable such as integer, char etc.
Whenever i working with the methods that returns status of the operations like succesful, failed like that. At that time i need to convert that in to constants. Then only i can move on switch statements.
But java 7 offers the Strings as case variables in Switch Statements, So we are free from the conversion process.
Multi-Exception Catch:
Another awesome update is Multi-Exception Catch, that means a single catch can handle multiple exceptions. The syntax is
1
try
2
{
3
block of statments
4
}
5
catch
(Exception1|Exception2|Exception3...)
6
{
7
block of statements.
8
}
It save lot of spaces in the code.
Bracket Notation for Collections:
This feature refers to the ability to reference a particular item in a Collection with square brackets similar to how Arrays are accessed. Collection is one of the key concepts in java.
But when i was a student, I feel so discomfort with collections because of its strutcture.Thats some thing different from basic things in java.
But now its also be like a simple things like array etc. For ex, a Collection class we might consider something similar to arrays.
Instead of:
1
Collection<String> c =
new
ArrayList();
2
c.add(“one”);
3
c.add(“two”);
4
c.add(“three”);
5
Use:
6
Collection<String> c =
new
ArrayList {“one”, “two”, “three” };
Thats all folks.If any important updates are missing don’t hesitate to add that as comments
Related articles
- Coder’s Delight- Java 7 (clean-clouds.com)
- Project Coin: “Small” Java 7 Tweaks, Big Dev Gains (devx.com)
- Java Version Market Share: January 2012 (jelastic.com)
- Garbage collection with Automatic Resource Management in Java 7 (javawithswaranga.blogspot.com)
- Null Pointer Exception occuring during graph generation (stackoverflow.com)
- Java 7 penetration gets to 10% of new server apps (jelastic.com)
- Eclipse Announces Full Support for Java 7 (prweb.com)
- NullPointerException when calling a private final variable in a method (stackoverflow.com)
- fatal exception: main caused by java.lang.NullPointerException menu button (stackoverflow.com)
- Null pointer when deploying WAR(s) (stackoverflow.com)
- BlackBerry Java SDK v7.0 – Now in Beta! (blogs.blackberry.com)
- The Java EE 7 Platform: Developing for the Cloud at Cloud Expo New York (java.sys-con.com)
Whenever, I am crawl through the web i notice the word java 7.Then,I really found out java 7 is today’s hot topic. So i googled it for know something about java 7.At that time i found out some thing interested and useful features in java 7.Thats push me here to share something to you all folks.Lets get into the topic.
The project name of java 7 development is Project Coin.I have listed some of the features below.
Null-safe Method invocation:
This is the greatest feature which is going to added in Java 7.NullPoniterException is one of the most common exception encountered in Java programming.
When I searched “NullPointerException” in Google, it gave about 5,570,000 results! This proves how pervasive the exception is and how much effort a developer has to put in writing java code free from null pointer exception.
Suppose if java has a feature to keep us in…
View original post 320 more words
Utterly written content material , thankyou for entropy.
LikeLike
Very interesting subject, thanks for putting up.
LikeLike
I believe this web site has got some very great info for everyone. “There is nothing so disagreeable, that a patient mind cannot find some solace for it.” by Lucius Annaeus Seneca.
LikeLike
Merely a smiling visitor here to share the love (:, btw outstanding style. “He profits most who serves best.” by Arthur F. Sheldon.
LikeLike
Only wanna input on few general things, The website pattern is perfect, the content material is really excellent : D.
LikeLike
I don’t even know how I stopped up here, but I thought this put up used to be great. I do not understand who you might be but definitely you are going to a well-known blogger in the event you aren’t already 😉 Cheers!
LikeLike
Grammer such as your’s has little place on the internets. I’m a funny guy!
LikeLike
Thankyou for all your efforts that you have put in this. very interesting information. “Illegitimacy is something we should talk about in terms of not having it.” by Dan Quayle.
LikeLike
This internet site is my intake , real good layout and perfect subject material .
LikeLike
Woah! I’m really enjoying the template/theme of this blog. It’s simple, yet effective. A lot of times it’s very hard to get that “perfect balance” between superb usability and visual appearance. I must say you’ve done a great job with this. Additionally, the blog loads extremely quick for me on Safari. Superb Blog!
LikeLike
Heya i am for the first time here. I found this board and I find It really helpful & it helped me out much. I am hoping to provide one thing back and aid others such as you helped me.
LikeLike
Just wanna state that this is handy , Thanks for taking your time to write this. “A sailor without a destination cannot hope for a favorable wind.” by Leon Tec.
LikeLike
Care for the land is the hallmark of a peaceful society. Well, that is what’s happening today on this website.
LikeLike
Hello there! Would you mind if I share your blog with my facebook group? There’s a lot of people that I think would really appreciate your content. Please let me know. Many thanks
LikeLike
I really appreciate this post. I’ve been looking all over for this! Thank goodness I found it on Bing. You have made my day! Thank you again! “That which does not kill us makes us stronger.” by Friedrich Nietzsche.
LikeLike
I used to be in search of this web site last three days good weblog proprietor wonderful posts every little thing is great
LikeLike
I like this web blog its a master peace ! Glad I discovered this on google. “Tears are the rinse water of an unhappy heart.” by Raynor Schein.
LikeLike
Hmm it seems like your site ate my first comment (it was super long) so I guess I’ll just sum it up what I wrote and say, I’m thoroughly enjoying your blog. I too am an aspiring blog blogger but I’m still new to the whole thing. Do you have any points for rookie blog writers? I’d genuinely appreciate it.
LikeLike
Hiya, I am really glad I’ve found this information. Today bloggers publish only about gossips and web and this is really irritating. A good web site with exciting content, this is what I need. Thank you for keeping this website, I’ll be visiting it. Do you do newsletters? Cant find it.
LikeLike
My brother suggested I would possibly like this blog. He used to be totally right. This put up actually made my day. You cann’t imagine simply how a lot time I had spent for this info! Thanks!
LikeLike
I always was interested in this topic and stock still am, thank you for putting up.
LikeLike
Keep up the wonderful piece of work, I read few posts on this web site and I believe that your website is really interesting and has bands of great info.
LikeLike