Pages

Presentation on Log4j

I had presented this some time back at my workplace. May be you'll find it useful.

Log4j Logging Mechanism
View SlideShare presentation or Upload your own. (tags: log4jjava)

Interesting Identifiers in Java

Ever seen a declaration like

_ _ = new _();

or call to a method like

System.out.println(_._());


Try this example, you'll see, these are valid java statements.
read on..


package test.identifiers;

/**
* example that shows various legal identifiers
*
* @author Kunal
*
*/
public class LegalIdentifiers {

int $1 = 1; // valid
long _6 = 6L; // valid
char t = '\t'; // of course valid, did u have any doubt ;)

class t{
}
t $; // now here t is type & $ is object of type t

class _{
int _ = 0;
int _(){ // method with name of constructor
return _;
}
}
_ _ = new _(); // _ is an object of type _ (underscore)

void display(){
System.out.println(_._()); // interesting, isn't it?
}
// this is not a fill-in-the-blanks question
// it actually compiles and runs :)

// this means
String String = "String"; // is valid
// yes it is !!!
// so you can have variable name same as class name

public static void main(String[] args) {
(new LegalIdentifiers()).display();
}
}