When Srikanth asked me this question, my immediate and disingenious response was to hide the semi-colon using a Unicode escape sequence like this:
public class Sriki
{
public static void main( String[] args)
{
System.out.println("Hello")\u003b
}
}
However, he has a better solution:
public class Sriki
{
public static void main( String[] args) throws Exception
{
if( System.out.getClass( ).getMethod(
"println",
new Class[] { String.class}).invoke(
System.out,
new Object[] { "Hello"}) == null)
{
}
}
}
Can you come up with a better solution?
(Originally posted on Advogato.)
|
Tweet |
|
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.