I have a string representing the name of a java file. I would
like to get a new string, where the extension .java has been
replaced by .class.

My approach was to use String#sub:

filename="abc/x.java"
filename.sub(/java$/,'class') 

This works fine, but I wonder whether there isn't a more
elegant way to do it.

Ronald
-- 
Ronald Fischer <ronald.fischer / venyon.com>
Phone: +49-89-452133-162