Monday 16 June 2014

How to print without main method

There is example that demonstrate above concept


public class Mainapp {

/**
* @param args
*/

static
{
System.out.println("hi...");
System.exit(0);
}

}


O/P:

hi...

this is one of the important question ask in interviews...
plz go through it..