Tuesday, November 29, 2011

Something strange in java

Hi Friends, Its been so long since we used it !!! I have almost forgotten about it.. may be you too :-) :-) here is something i found interesting about java.. just copy the below code and save it in a file called Test.java.. execute and c the fun :-) :-)

public class Test


public static void main(String args[])


int a=10;

String s=null;

// If you try to execute below line it will throw nullpointer exception

// System.out.println(s.length());

// as it is illegal to access length of a a string having null value

// now c this


System.out.println(s.length()); // oh, it works !!! and prints 6
System.out.println(a=13 ); // It prints the value assaigned to it

System.out.println(a==13 ); // prints the result of comparision
System.out.println(a++); // value is printed but incrementataion is actually affected
System.out.println(a); // here


Thursday, September 10, 2009

Saturday, August 29, 2009


welcome to 5th Semester Friends... U can Utilize this platform for ur creative talents.. enjoy..

Monday, April 27, 2009