Java is a programming language, XHTML is a markup language.
Java can be used to add program functionality into a Web page (it needs to be compiled before use).
XHTML is kind of like the next version of HTML. It is used like HTML, and you can put Java applets into the XHTML page.
If you are just needing to create a Web site, use XHMTL. If you need a program, or applet, to add specific functionality that a markup language cannot do, you'll need to use Java. It really depends on what you want for an end result.