Thu Feb 05, 2009 12:31 am
public class Main {
public static void main(String[] args) {
Main test=new Main();
circle newc=new circle();
newc.setR(43);
System.out.println("Before calling method : R="+newc.getR());
test.changeR(newc);
System.out.println("After calling method : R="+newc.getR());
}
public void changeR(circle c)
{
c.setR(32);
c=null;
}
}
interface shape
{
public void Draw();
}
class circle implements shape
{
private int R;
public void Draw() {
System.out.println("Drawing Circle here");
}
public void setR(int R) {
this.R = R;
}
public int getR() {
return R;
}
}
Before calling method : R=43
After calling method : R=32
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.