TvQuran

Monday, December 14, 2009

Unknown Java Traps that most of us fall in, Video Inside

I watched yesterday awesome tutorial that you deserve to see.
It's about Traps, Pitfalls, and Corner Cases in our lovely language, Java, It deals with 8 issues that most of us fall in it, Not to talk too long, I'll show you the first easy example and let you discover the rest and the reasons at this awesome video introduced by Google.

Problem One:
Here is a Java code and the question is to find the output and the reason of your selection, there are 4 multiple choices to select one from it, let's dance :)

public static void main(String args[]) {
            Set set = new HashSet();
            for (short i = 0; i < 99; i++) {
                set.add(i);
                set.remove(i - 1);
            }
            System.out.println(set.size());
        }

The Options is :
  • 1.
  • 99.
  • Through an Exception.
  • None of the above.
You will find the detailed solution with reasons at the first 5 minutes of the video.
Now, I'll let you with the awesome video by Josh Bloch and Bill Pugh.




for any questions, I'll be here and hope to enjoy the tricks.
Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

8 comments: on "Unknown Java Traps that most of us fall in, Video Inside"

Ahmed Elsayed Shoeib said...

thanks semsem for this topic
keep on keep forward

Gaby said...

Very interesting :-D! thanks for share it!

Islam El-Hosary said...

@Gaby
you are welcome .. thanks for support and wait the next ;)

Anonymous said...

مشكوووووووووووووووووووووووووووووووووووووووووووووووووور

Islam El-Hosary said...

@Anonymous
you are welcome :)

Ahmed El- Sadek said...

Nice one. Great work Islam :)

Islam El-Hosary said...

Thanks Ahmed for your support

Post a Comment