The Gyakuten Saiban/Ace Attorney series that I've been poking at is basically made of terrible puns. The Japanese, if you haven't noticed, love these things. Both spoken and written puns are much easier to construct in Japanese than in many other languages -- although the visual ones don't always work when read aloud, and the aural ones don't always work in text -- for a number of reasons.

First and foremost are the borrowed Chinese characters. Called kanji in Japanese and hanzì in Mandarin (both written 漢字), they came into widespread use back in the ancient court days, when the high-ranking men would keep official records in Chinese script, mostly as a status symbol ("behold, I have to do so little physical peasant labor that I can learn an entire other complicated language without starving") to prevent the plebs from getting into them. I can't swear that women were never taught Chinese, but educated women wrote in the vernacular, using hiragana, which are simple characters derived from kanji that stand strictly for phonemes, and carry no meaning themselves. Genji Monogatari, a court romance written by a woman named Murasaki Shikibu and passed around among the ladies of the court in serial format, was penned in hiragana. Also things like Sei Shonagon's Pillow Book, so named because it covers all of the things people get up to in beds, particularly the dirty ones.

Kanji in modern Japanese are used for names, nouns, compounds, occasional prepositions, and the stems of adjectives, adverbs, and verbs[1]. Most kanji have more than one spoken pronunciation -- usually one for the native Japanese word that matches its meaning (the kun reading), and one or more derived from the original old Mandarin pronunciation of the character (the on reading). "Derived" is possibly the wrong word for that; it implies some kind of complicated pre-planned method for conversion, when in fact what they did was just steal them all wholesale and smash tone, because Japanese is a non-tonal language[2]. As a result, there are very, very few kanji that have a unique on reading. If you want a demonstration, find yourself a kanji dictionary that has an index of characters by pronunciation, and look up the welter of totally unrelated things under sei or kai or kan. You will cry. Very occasionally, the kun reading will collide with the on reading of something else. The word kaeru, when spelled as a verb, (the stem ka in kanji, the inflectional ending eru in hiragana) means 'to change' when written with one kanji or 'to return' when written with another, and if it's rendered as a single kanji (or phonetically in katakana), it means 'frog'.

You can probably see where all that is going. It's incredibly easy to construct a word that means one thing, but is read identically to something completely different. The same characters are also used for names, although they may or may not be read differently in that case. That's the whole point of the manga/anime series Tenchi Muyo, in fact. Tenchi's name is spelled 天地無用, which literally says 'heaven, earth, nothing, use'. The translation of the series title is usually rendered as "Useless Tenchi" or "No Use For Tenchi" -- that is, grouping the first two characters into the protagonist's name, Tenchi, and grouping the last two into a word that means 'lack of usefulness' -- but the literal meaning is "do not use in such a manner that the heaven-ward side is turned to the earth", i.e., it's the phrase stamped on boxes that means THIS SIDE UP[3].

Portmanteau words -- that is, words that are created by combining two other words, as with the old portmanteaux used when voyaging by steamship, which combined a travelling trunk with a small wardrobe -- are also quite popular. The moguri of Final Fantasy, called 'moogles' in English, were named by combining mogura, "mole", with koumori, "bat", to describe a little underground-dwelling rodenty thing with leathery wings on its back. (Chocobos are a truncation of チョコボール, "Chocoball", the name of a Japanese candy.) The Omochaos from Sonic Adventure are a combination of Chao, the name of the critter, and omocha, a toy. Those Tamagotchi things that were frigging everywhere when I was in high school are a combination of tamago, egg, with tomodachi, friend, with the added bonus that -cchi is a common ending or suffix for pet names -- Pocchi is the standard dog name in Japanese, much as Rex or Rover is in English.[4]

There are also a wide variety of puns and puzzles based on the fact that many kanji were originally mashed together from two or three separate characters, usually one which carried the desired meaning and one which carried the desired pronunciation. These pieces are called radicals, and you learn them very quickly, because the radical index is the most useful one in your dictionary, and if you don't recognize the kanji in the first place there's no way to look up the meaning from the pronunciation that you don't know[5]. Things like, "How do you freeze water with a pencil?" (You add one stroke to [水], mizu, "water", in order to make it [氷], koori, "ice") or "How do you keep a woman safe?" (You 'put a roof over her head' -- write [女], onna, "woman", with a radical atop it that derives from a thing that originally meant 'roof' or 'house', to make [安], an, "safety".) One word that no one in class ever forgot was [薬], kusuri, "drug/medicine", because it happens to be written with the character for 'enjoyment' [楽], topped with a radical that means 'grass/plant'[6].

There's yet another class of word play in Japanese that's based on swapping out kanji in set phrases, mostly aphorisms borrowed from Chinese or composed in Chinese style. These are sometimes used for quizzes when children are learning kanji at school, mostly in the form of "you know this phrase, fill in the blanks", and as you might expect, there are a large number of creative ways to fill them in wrong. I've forgotten most of the ones our university instructor taught us, but one of the funnier ones was [_肉_食]. You're supposed to fill this in as [弱肉強食], "weak meat strong eat", i.e., the weak are preyed upon by the strong; the smartass answer is [焼肉給食], "grilled meat (for) school lunch". This one is sometimes also done verbally; Sana, in the anime Kodomo no Omocha, is notorious for trying to recite aphorisms like this and swapping in bafflingly, hilariously wrong words. Between that and the fact that she yammers about a million miles an hour, multiple fan translation groups were actually driven to quit after just a few episodes, by constantly trying to smash all of the subtitles for what she's saying and enough explanation for non-native speakers to get the joke onto the screen without obliterating the picture.

And then occasionally the kanji inadvertently turn out to be ironic. The word for cat, [猫], neko, is composed of the radicals that mean "wild animal" and "narrow". The traditional generic cat names, however, are Tama, "ball", and Maru, "round". Three guesses as to how narrow Japanese cats usually are.

1:  Japanese does not conjugate for subject at all, but adjectives have inflections for states like 'present', 'past', 'too much', etc., and verb tenses/moods/social ranks are quasi-polysynthetic, by which I mean that there is a method for stacking them together like LEGO. It's possible to construct one extremely long verb that means, roughly, "I humbly beg of Your Worship the honor of having had taken a seat taken for yourself, if this favor please you well," which in English would be rendered simply, "Please have a seat, sir."

2:  Mostly. The grammar books say it's monotonic, but there are subtle emphasis changes that distinguish hana-flower from hana-nose, or hashi-bridge from hashi-chopsticks. It's something like the difference between invalid-lacking in validity and invalid-one who is ill for a long period of time.

3: Completely unrelated, but it's remarkable how many languages choose to express the idea that this shipping crate should not be rotated all willy-nilly by pointing out which bit should be the top. It's not universal, though. When I stocked shelves in a department store, we carried candy from Lindt, who is a Swiss chocolatier, and the boxes were marked in English, French, and German. The French said ce côté en haut, which is exactly the same as the English. The German markings said nicht werfen, which literally means "don't throw". The other employees there also sometimes asked me what the not-English said on things like those little silica sachets they throw in packing boxes to keep the contents dry -- I'm not sure what  they expected out of that, honestly. "Oh, well. The Spanish, French, German, Italian, and Japanese all say 'do not eat', but the Chinese bit here says 'free candy'."

5: I'm not great with Pokémon, but most of the names I do know are onomotopaeia. Pikachu is a combination of the zappy sound electricity or lightning makes, and chuu, the squeaking noise made by small rodenty things. The little winged furball thing that sits on D's shoulder in Pet Shop of Horrors is called "Q-chan" as a play on kyuu, the squeaking of a bat.

5: Answer to obvious question: If you don't know how it's read and you can't figure out which radical it's under, you count the number of pen strokes needed to write it, and then go slowly blind going through pages and pages of tiny index print, trying to find it in a list of every kanji ever that is written using that number of strokes. This is the opposite of fun. The number of strokes is not the same as the number of lines; several kinds of strokes turn corners, and it's not always obvious which serifs are necessary and significant, and which ones are just part of the typeface.

6: The character for 'fun' is also complicit in an entirely different class of puns, because the word for music is 音楽, ongaku, literally 'enjoyable noises'. The character itself has no connection to music, but has collected the connotation because of this one word. It's useful for silly jokes, because in that word (and only in that word, so far as I know) it's read gaku, which is also the reading for [学], a character which pertains to school and studying. Gackt for some reason has decided that his stage name also has a kanji spelling, 楽斗, gakuto. The second character means some sort of a vessel used for containing and pouring-- it's also used in 北斗, hokuto, literally "north ladle", which is the Japanese word for the constellation the Big Dipper -- and the name can potentially be interpreted as 'vessel for pouring forth music' or 'vessel for pouring enjoyment'.