Posted in Java by Dan on August 24th, 2008

This little trick is shamelessly stolen from Daniele Futtorovic’s post on comp.lang.java.programmer.

This is legal, compilable Java:

public class Oddity { public static void main ( String [ ] args ) { http: //blog.uncommons.org System . out . println ( "Why is the URL allowed above?" ) ; } }

Why doesn’t the URL being in there upset the compiler? If you’re not sure why it’s valid, click “show” for a spoiler.

show