Posts Tagged ‘Null’

Null Check in Java 7.0

Monday, March 2nd, 2009
Null check is becoming easier in Java7.0. I hope most of you aware of this. I was reading one of the java blog and found the following is interesting there.Earlier Version of Java
			Car car = ...Integer tilt = null;
				if(car != null) {
					Sunroof sunroof = car.getSunroof();
					if(sunroof != null) {
						tilt = sunroof.getTilt();
In Java7.0, the above statement can be written as.
			Integer tilt = car?.getSunroof()?.getTilt();
Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on
Shout it
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter
Google Buzz (aka. Google Reader)
Get Adobe Flash player