Embed presentation
Download to read offline
![//Ques. 4 WAP to initialize different objects with different values
class different
{
int a,b,c;
void initialize (int d,int e,int f)
{
a=d;a=e;c=f;
}
public static void main(String arr[])
{
different mob = new different();
different code = new different();
int d,e;
mob.a = 2;
mob.b = 3;
mob.c = 4;
code.a = 4;
code.b = 5;
code.c = 6;
d = mob.a* mob.b* mob.c;
e = code.a* code.b* code.c;
System.out.println(" n The Value of d is " +d);
System.out.println("n The Value of e is " +e);
}
}](https://image.slidesharecdn.com/different-131127075021-phpapp02/85/WAP-to-initialize-different-objects-with-different-values-in-java-1-320.jpg)


This code defines a class called "different" with integer instance variables a, b, and c. It initializes two objects of this class, mob and code, with different values for a, b, and c. It then calculates the product of a, b, and c for each object and prints the results.
![//Ques. 4 WAP to initialize different objects with different values
class different
{
int a,b,c;
void initialize (int d,int e,int f)
{
a=d;a=e;c=f;
}
public static void main(String arr[])
{
different mob = new different();
different code = new different();
int d,e;
mob.a = 2;
mob.b = 3;
mob.c = 4;
code.a = 4;
code.b = 5;
code.c = 6;
d = mob.a* mob.b* mob.c;
e = code.a* code.b* code.c;
System.out.println(" n The Value of d is " +d);
System.out.println("n The Value of e is " +e);
}
}](https://image.slidesharecdn.com/different-131127075021-phpapp02/85/WAP-to-initialize-different-objects-with-different-values-in-java-1-320.jpg)
