In order to program AJAX, you need to know JavaScript and a server-side language. After all, it stands for Asynchronous JavaScript And XML. To get started with the client-side (JavaScript) part, take a look here.

After that, you will need to learn a server-side language. This could be PHP or ASP. There are more, but those are what I know. I will always chose PHP over ASP for many reasons.

As for Java, don't get it mixed up with JavaScript. They are two totally separate languages with some similar syntax. JavaScript is a client-side (internet browser) language. It was designed to make websites more interactive. Java is an object oriented language that I hate. It is very slow and I can accomplish what I need to without it.