//Immutable class Example - save as "immutable.java"
import java.util.ArrayList;
final class immutable {
private String str=null;
public void setString(String str1)
{
str=str1;
}
public String getString()
{
ArrayList arr =new ArrayList();
arr.size();
System.out.print("------->"+arr.size());
return str;
}
public static void main(String args[])
{
immutable obj=new immutable();
obj.setString("XYZ");
ArrayList arr =new ArrayList();
arr.size();
}
}
Friday, February 13, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment