What exactly does this phrase mean and in which situations is it used?
It is used as an expression of gloating when someone turns the tables on someone else. There is a good example in the movie Good Will Hunting, where Matt Damon's character (Will Hunting) gets a girl's phone number in a Harvard bar where he, coming from working-class South Boston, is, despite his extraordinary intellect, socio-economically out of his league and is insulted by the Harvard rich kid (Clark) whom he has bested — actually, destroyed — in an argument. On the street later he sees his rival for the girl's attention through a restaurant window. He goes up and raps on the glass to get the young man's attention, and the following dialogue occurs:
Will: Do you like apples?
Will: Well, I got her number. How do you like them apples?
It can also be used as an expression of surprise at a sudden turn of fortune.
It can also be used interchangeably with "well don't that beat all."– MaxpmJan 10, 2011 at 6:26
@Maxpm- It most definitely cannot!– JimJul 28, 2014 at 5:56
1In the movie Chinatown (1974) Jack Nicholson's character uses this expression to convey his surprise at a sudden turn of events, at the 45 minute mark.– q-l-pFeb 28, 2018 at 8:46
Robusto's answer does a good job explaining the meaning of the sentence, but for the sake of completeness, here's the origin of the phrase.
Apparently during the first World War, the Allies had an anti-tank grenade which was colloquially referred to as a "toffee apple" thanks to the appearance of its bulb:
In the John Wayne movie "Rio Bravo", one of the characters launches a "toffee apple" at the enemy lines and says the phrase "How you like them apples?" referring, of course, to the bomb. As movie phrases are wont to do, it entered popular consciousness as a boastful expression of triumph.
+1 I didn't know that. I had always thought it was just an aggressive poseur asked when someone went about 'upsetting the apple cart'. Sep 12, 2011 at 18:34
5Bit of a stretch that a phrase first documented in a 1952 cowboy film came from a WWI trench mortar– mgbSep 13, 2011 at 2:33
1@Martin: I looked this up and found three or four independent sources backing up this origin story, and no other ones seriously put forth. Sep 13, 2011 at 5:31
This made me think of the standard US hand grenade of WW2, which had the nickname "pineapple" because the pattern of grooves cast into its body: en.wikipedia.org/wiki/Mk_2_grenade I'm pretty sure this has nothing to do with "them apples", though it seems it could have! Jul 10, 2014 at 22:17
2As PJB says, Rio Bravo is a Western and it was dynamite they were throwing. As in the case of the Good Will Hunting scene, the context makes it seem like the audience is expected to already recognize the phrase, so it seems to me that the phrase was already in the popular consciousness. The WWI explanation might be it, but it wouldn't surprise me if the soldiers were also making reference to something even older.– kcrumleySep 13, 2015 at 5:00
I'm pretty sure that the phrase, "how do you like them apples," does not appear in the Wizard of Oz. The apple tree says, "What do you think you're doing!" and "How would you like to have someone come along and pick something off of you."
Rio Bravo was a western - no one shot a "toffee apple" mortar in the movie. If they did use the phras, "how do you like them apples," it would be an anachronism, because the phrase was apparently popularized during World War I.
The British had a trench mortar that was called a "toffee apple." The same mortar was alternately called, "plum pot."
Early in the war, before the "toffee apple" trench mortar was developed, soldiers made improvised explosive devices, grenades and mortars using empty "plum and apple" jam tins. The words "plum" and "apple" may have been associated with mortars and grenades as a result.
Other grenades were also called "apples" during the war, so it was not always a specific reference to the "toffee apple"-style trench mortar.
But even though the expression became popular during the war, there is one known example (as far as I know) of the expression used in Texas in 1895 (also at the above link), so it may have been regional or not widely known before it spread in the trenches of WWI. And its original meaning may not have had anything to do with trench mortars or grenades, even if they played a role in how troops understood or used the expression during the war:
Bryan is the best cotton market in this section of the state and has received more cotton than any other town in this section. How do you like "them apples?"
The Eagle, (Bryan, Texas), September 26, 1895, page 2.
This phrase appears in the Wizard of Oz in 1939, years before rio bravo. In the first scene with the Tin Man, a tree throws apples at him and says, "How do you like them apples!"
Also in the Movie Chinatown (1974). J.J. Gittes (played by Jack Nicholson) says, "How do you like them apples" after talking on the phone with Miss Sessions (who earlier pretended to be Mrs. Mulwray).– user86447Jul 28, 2014 at 5:34
An episode of Perry Mason ("The Case of the Sunbather's Diary" Season 1, Episode 17) has the phrase as "How do you like those potatoes?" A language book from the 1920s uses this version of the phrase in a setting that suggests the 'them potatoes' version was also popular: http://books.google.com/books?id=W9kRAAAAIAAJ&dq=%22how%20do%20you%20like%20those%20potatoes%22&pg=PA43#v=onepage&q=%22how%20do%20you%20like%20those%20potatoes%22&f=false
Looking through Google Books, both 'them/those apples' and 'them/those potatoes' seem to only go back to about the 1920s in print, but the earliest version being a 1919 book of military history where it's listed, without elaboration, amongst humorous stories and sayings. http://books.google.com/books?id=rndBAAAAYAAJ&dq=%22how%20do%20you%20like%20them%20apples%22&pg=PA148#v=onepage&q=%22how%20do%20you%20like%20them%20apples%22&f=false
This suggests the military origin of the phrase to be correct, though in use before it was said in any movie.
As for the meaning -- older versions tend to use it as an expression of surprise, akin to "How 'bout that!" or "I'll be!" Nowadays, however, it's most commonly used as an expression of gloating. (Person #1: "I got 20 points in the game!" Person #2: "Well, I got 200, so how do you like them apples?")