raski said:
i was wondering if any of you guys would know any trick i could
pull on some of my friends on a java based chat room. nothing
harmful, only for playing around...
The following program will print »Hello!«.
public class Hello
{ public static void main( final java.lang.String[] args )
{ java.lang.System.out.println( "Hello!" ); }}
This trick works by exploiting the JLS and the Java-API,
forcing the JVM to print »Hello!«. Both the Java Security
manager and the Java "sandbox" usually will not prevent this
to be actually executed!
But be careful: The text will be printed /immediatly/ as soon
as the program is started, there will not be a prior warning
or a an inquiry. So, you might not try this at home. But
possibly you could fool your friends in the chat room into
compiling and running it? That would be fun! I'd like to see
the baffled look on their faces when suddenly out of the blue
the text »Hello!« appears on their screen.
Even more cool: The text »Hello!« can be replaced by any other
text, in order to print that other text. So it is great for
playing around. Just give it a try!