yes, you can use vi to write Java code on linux. i do.
you don't necessarily
have to use vi, however. pretty much any decent linux distribution should come with more different editors to choose between than any one person will ever need; try a few and use the one that you like most. so long as you save your files as plain text - and any editor short of a
word processor will do that by default, anyway - you'll be able to compile the Java code you write without any trouble.