Great non-obvious java tricks

Posted by folone on Stack Overflow See other posts from Stack Overflow or by folone
Published on 2010-04-13T10:04:34Z Indexed on 2010/04/13 10:13 UTC
Read the original article Hit count: 492

Filed under:
|
|

Consider having a class:

public class Test
{
   public static void main(String [] args)
   {
       for (int i = 0; i < args.length; i++)
       {
           System.out.println(args[i]);
       }
   }
}

What happens if you run it: java Test *?

Answer: it prints out all the filenames in current directory.

Got more such tricks?

© Stack Overflow or respective owner

Related posts about java

Related posts about tricks