how do i make my object animate???

ok ive exported my gun with about 10 animations: Fire Reload Aim Put away Sway Left/Right/Up/Down and some other minor things just wondering how i would make them play when i press a button or something? is there some kind of java code or is there a way to do it normaly? using 3.3 thanks.

ps:how do i make my waepon sway to the motion of the mouse?

Did you see this?

First take a look at below. You need to assign animation clips first. (specify name and frames e.g. 0-59)

After you create animation clips, you could simply play them by pressing a key:

function Update(){