Yesterday I came across an interesting article on surveys conducted by the UN. Here's an extract from that article; hope you'l enjoy reading it.
"Would you please give your honest opinion about solutions to the food shortage in the rest of the world?" was the question asked by the UN in one of its worldwide surveys.
The Africans did not know what "food" was and
the Asians did not know what "honest" meant.
In Europe they did not know what "shortage" meant.
The Middle East did not know what "solution" meant and
in South America they did not know what "please" meant.
And in North America they did not know what "the rest of the world" meant!
The survey was thus able to unmask the original character of the people worldwide.
Tuesday, September 9, 2008
Thursday, May 29, 2008
Take my advice, I won't use it anyway!
1. Do nothing!
Sumit often tells me that I spend most of my time doing nothing.
Guys believe me "doing nothing" is the hardest thing to do; the moment you do it you are no longer doing it!
2. Who says there are no easy ways to make $s , i shall teach you one:
"Repeatedly press shift-4"!
3. There's no fun meeting the deadlines, the real fun lies in beating them!
Now the following quotes are my personal favorites.
4. Follow the trend(herd), you won't get lost!
5. Don't stay laid-back, you may get laid off!
6. "Winners have one thing in common and blah blah blah....." - all nonsense!
I would rather say
"Losers have one thing in common, they all write anonymous blogs!"
Sumit often tells me that I spend most of my time doing nothing.
Guys believe me "doing nothing" is the hardest thing to do; the moment you do it you are no longer doing it!
2. Who says there are no easy ways to make $s , i shall teach you one:
"Repeatedly press shift-4"!
3. There's no fun meeting the deadlines, the real fun lies in beating them!
Now the following quotes are my personal favorites.
4. Follow the trend(herd), you won't get lost!
5. Don't stay laid-back, you may get laid off!
6. "Winners have one thing in common and blah blah blah....." - all nonsense!
I would rather say
"Losers have one thing in common, they all write anonymous blogs!"
Sunday, May 11, 2008
Tentacles of a dilemma
Now this is what I call an achievement!With just a couple of not-so-interesting (or should I call 'boring') posts I have made people shout at me "Dada, please don't preach!" and thereby justifying the title of my blog.
To quote a very dear friend of mine :
"Abey java pe to sari duniya bakwaas ker leti hai... others pe kuch log hi ker sakte hain.. aur tum unme se ek ho dost. " - I must say he was very polite!
So here I am to preach on "life in general".
I was never more confused in life.Computer Science(supposedly my expertise, after all I am a CS undergrad from IIT) has always left me clueless but then there is this "google search" which has always pulled me out!But of late life has been ruthlessly hurling questions at me at such a rate that I have developed a permanent confused look on my face and people around me have started calling me "Halu"(delirious :P).
This interesting phase of weird questionnaire had started when I was about to graduate out of my college, presaging what was in store for me!
What is your greatest achievement in life?
I faced this on my very first day of job(HR training).
Is it necessary that I have achieved something in my life? Am I not here to achieve something? Cracking IIT or getting this job - would these qualify as achievements, specially when 40 other guys are sitting around me with the same qualifications?
I was stunned!
Are you not from an ICSE school?How come you flunked in GRE verbals?
This is how a friend reacted when he came to know about my low verbal scores in GRE.
Dude...I still don't understand why you need to know the antonym of "pontifical" or draw an analogy with "morass" to get a pass to the US of A. I am of the firm belief that :
"Hey wassup?"
"Doin good...what abt u?"
"Me doing gr8..hehe!"
is all you need to survive there.
Hey you are from IIT! Why here?
This is a common question, my non-IITian colleagues throw at me.
How would I explain it to them that we IITians aren't any freaks of nature; we really don't have wings that we could fly to anywhere we want.It's plain and simple that you have toiled very hard in your college and I have struggled very hard in my IIT and so we both are at the same place![;)]
What are your future plans?
This is the most dreaded of all and is almost invariably asked by every individual self who knows me.
Sometimes I pretend to be carefree by saying that I had slogged a lot for four long years of BTech and now I want a break.But, they knowing my nature can hardly associate "me" with "slogging"!
"I really have no sight of my future and if at all someone is to be blamed for this , it is my myopia which I had picked up at quite an early age!" - hope I gain some sympathy now!![:)]
So guys sing with me :
"Que Sera, Sera,
Whatever will be, will be
The future's not ours, to see
Que Sera, Sera
What will be, will be."
To quote a very dear friend of mine :
"Abey java pe to sari duniya bakwaas ker leti hai... others pe kuch log hi ker sakte hain.. aur tum unme se ek ho dost. " - I must say he was very polite!
So here I am to preach on "life in general".
I was never more confused in life.Computer Science(supposedly my expertise, after all I am a CS undergrad from IIT) has always left me clueless but then there is this "google search" which has always pulled me out!But of late life has been ruthlessly hurling questions at me at such a rate that I have developed a permanent confused look on my face and people around me have started calling me "Halu"(delirious :P).
This interesting phase of weird questionnaire had started when I was about to graduate out of my college, presaging what was in store for me!
What is your greatest achievement in life?
I faced this on my very first day of job(HR training).
Is it necessary that I have achieved something in my life? Am I not here to achieve something? Cracking IIT or getting this job - would these qualify as achievements, specially when 40 other guys are sitting around me with the same qualifications?
I was stunned!
Are you not from an ICSE school?How come you flunked in GRE verbals?
This is how a friend reacted when he came to know about my low verbal scores in GRE.
Dude...I still don't understand why you need to know the antonym of "pontifical" or draw an analogy with "morass" to get a pass to the US of A. I am of the firm belief that :
"Hey wassup?"
"Doin good...what abt u?"
"Me doing gr8..hehe!"
is all you need to survive there.
Hey you are from IIT! Why here?
This is a common question, my non-IITian colleagues throw at me.
How would I explain it to them that we IITians aren't any freaks of nature; we really don't have wings that we could fly to anywhere we want.It's plain and simple that you have toiled very hard in your college and I have struggled very hard in my IIT and so we both are at the same place![;)]
What are your future plans?
This is the most dreaded of all and is almost invariably asked by every individual self who knows me.
Sometimes I pretend to be carefree by saying that I had slogged a lot for four long years of BTech and now I want a break.But, they knowing my nature can hardly associate "me" with "slogging"!
"I really have no sight of my future and if at all someone is to be blamed for this , it is my myopia which I had picked up at quite an early age!" - hope I gain some sympathy now!![:)]
So guys sing with me :
"Que Sera, Sera,
Whatever will be, will be
The future's not ours, to see
Que Sera, Sera
What will be, will be."
Monday, May 5, 2008
Object class - is it really the cosmic superclass?
Suppose you have the following with you
Object obj;
Object[] objArr;
Let me start with a couple of Java statements :
1. obj = "Java";
2. obj = 10;
3. obj = true;
4. obj = new int[10];
5. objArr = new int[10];
6. objArr = new String[10];
You would be surprised if I tell you that statements 2,3 and 5 are erroneous!
Hold on!
"Every class in Java extends Object" then why such a discrepancy?
Point 1 : Primitive types(numbers, characters, boolean) are not objects(they do not belong to any class).This explains why 2 & 3 are wrong.
Point 2 : String is not a primitive type(this explains why 1 is correct)
Point 3 : All arrays(even arrays of primitive types) derive from the Object class.(this explains why 4 is correct)
Now the question is why 5 is wrong but 6 correct?
You cannot convert an array of ints to an array of Objects, because that will mean each int(of the int[]) getting converted to an Object(of the Object[]) which is not permissible(point1).
But the same thing works for 6 because a String getting converted to an Object is permissible(point2).
So what is the way out for primitive types?
Wrapper classes!
The primitve types can be converted to Objects using the wrapper classes - Integer,Boolean,Double etc.
For example,
Integer a = new Integer(10);
obj = a;
should work fine.
For that matter whenever you need to use a primitve type in a place which expects an Object, use the wrapper classes to generate an Object first.
Note : If you are using Java 1.5 your compiler won't show errors on statements 2 & 3.This is because Java 1.5 supports the automatic conversion of primitive types to the corresponding wrapper objects.However statement 5 would still be an error there.
Object obj;
Object[] objArr;
Let me start with a couple of Java statements :
1. obj = "Java";
2. obj = 10;
3. obj = true;
4. obj = new int[10];
5. objArr = new int[10];
6. objArr = new String[10];
You would be surprised if I tell you that statements 2,3 and 5 are erroneous!
Hold on!
"Every class in Java extends Object" then why such a discrepancy?
Point 1 : Primitive types(numbers, characters, boolean) are not objects(they do not belong to any class).This explains why 2 & 3 are wrong.
Point 2 : String is not a primitive type(this explains why 1 is correct)
Point 3 : All arrays(even arrays of primitive types) derive from the Object class.(this explains why 4 is correct)
Now the question is why 5 is wrong but 6 correct?
You cannot convert an array of ints to an array of Objects, because that will mean each int(of the int[]) getting converted to an Object(of the Object[]) which is not permissible(point1).
But the same thing works for 6 because a String getting converted to an Object is permissible(point2).
So what is the way out for primitive types?
Wrapper classes!
The primitve types can be converted to Objects using the wrapper classes - Integer,Boolean,Double etc.
For example,
Integer a = new Integer(10);
obj = a;
should work fine.
For that matter whenever you need to use a primitve type in a place which expects an Object, use the wrapper classes to generate an Object first.
Note : If you are using Java 1.5 your compiler won't show errors on statements 2 & 3.This is because Java 1.5 supports the automatic conversion of primitive types to the corresponding wrapper objects.However statement 5 would still be an error there.
Labels:
inheritance,
Java,
Object,
programming,
wrapper classes
Subscribe to:
Comments (Atom)
