class object_new
{
int id;
String name;
public void method1(int d,String n)
{
id = d;
name = n;
}
public void display()
{
System.out.println("My id is :"+ id);
System.out.println("My name is :"+ name);
}
}
class object1
{
public static void main(String args[])
{
object_new obj=new object_new();
object_new obj1=new object_new();
obj.method1(99,"Balwant Singh");
obj1.method1(101,"BSB");
obj.display();
obj1.display();
}
}
{
int id;
String name;
public void method1(int d,String n)
{
id = d;
name = n;
}
public void display()
{
System.out.println("My id is :"+ id);
System.out.println("My name is :"+ name);
}
}
class object1
{
public static void main(String args[])
{
object_new obj=new object_new();
object_new obj1=new object_new();
obj.method1(99,"Balwant Singh");
obj1.method1(101,"BSB");
obj.display();
obj1.display();
}
}
No comments:
Post a Comment