Sunday, July 25, 2010

Predict the output for this java program

0 comments
class demo
{
int a=4;
public void show()
{
System.out.println(a);
}
public static void main(String args[])
{
a++;
show();
}
}



Predict the output

0 comments
class dem
{
int a;
dem(int a)
{
this.a=a;
}
public void show()
{
System.out.println(a);
}
}
class demo
{
public static void main(String args[])
{
dem d=new dem(4);
dem e=d;
d.a++;
d=null;
e.show();
}
}

Visitors

Followers

 

Java Interview Questions. Copyright 2008 All Rights Reserved Revolution Two Church theme by Brian Gardner Converted into Blogger Template by Bloganol dot com