what I mean is that, when I click a hyperlink on a webpage it will call a .java file which will then show "text or image"..is it possible? if yes how?....please suggest.......thanks

Yes, this is easily possible with JSP and Servlets. Please post the question over in the JSP forum, which is there for just such questions.

A .java file is a source file i.e., a text file so only the java source code will be visible.

In case you want to load an Image or some other text use Java Applet programming. You can find a good amount of examples with the JDK installed on your system. Go to <JDK_HOME>/demo and run the demo applications provided. Its the best place to get started with Java applications and learn Java Programming by looking the source code and then writing your own.