class apples
{
public static void main(String[] args)
{
orange obj=new orange(4,7,1990);
}
}
class orange
{
private int day;
private int mounth;
private int year;
public orange(int d, int m, int y)
{
day=d;
mounth=m;
year=y;
System.out.printf("object has been initialized with value %s",this);
}
public String toString()
{
return String.format("%d/%d/%d",day, mounth, year);
}
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.