difference between よ and んだ


What's the difference in using んだ and よ to end a sentence? For example:

嬉しい **よ**

嬉しい **んだ**

Both of them sorts of either answers a silent question or gives new/sometimes
unexpected information about the sentence if I am not mistaken




嬉しい **んだ** is the casual (spoken) form of 嬉しい **のです**. This form is used for a
[variety of reasons](https://www.learn-japanese-adventure.com/japanese-
sentence-no-desu.html) but primarily to give a reason or explanation (or ask
for one). It can be unnatural if used elsewhere so is best avoided if you are
not confident with it (の also has uses as a nominaliser, possessive particle,
and pronoun; these are all different). In this case 嬉しいんだ would be explaining
that the reason for something (such as your behaviour) is happiness.

嬉しい **よ** is the casual form of 嬉しい **ですよ**. Similarly 嬉しい **ね** is the casual
form of 嬉しい **ですね**. These are used more often in casual situations than
formal or written Japanese (except maybe for dialog). These are often
translated to "you know?" (for よ) or "isn't it?" (for ね) but they aren't
strictly questions. They also [have many
uses](https://kawakawalearningstudio.com/all/how-to-use-japanese-
particles-%E3%81%AEno-%E3%82%88yo-%E3%81%ADne-and-%E3%81%8Bka-in-the-ending-
sentence/) but are usually used when it is expected that the listener will
agree with them. よ gives more emphasis and sounds "rough" so it's more often
used by Japanese men. よ is used more for asserting things they assume they
listener will agree with but may not be aware of. ね is expected the listener
to respond by agreeing but can be used rhetorically like "right?" or "aye" in
English. ね is also fairly colloquial and used to show empathy or invite the
listener to respond or continue speaking. These are both quite common when
chatting in Japanese but I think using ね is less likely to offend than よ. So
嬉しい **よ** could be used to say "this makes me **really** happy" and 嬉しい **ね**
could be used to say "that makes you happy, **right?** ".

