-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path35_ReturnObject1.java
More file actions
54 lines (46 loc) · 1.12 KB
/
35_ReturnObject1.java
File metadata and controls
54 lines (46 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
*Program to return object after taking value from user
*/
package javaprograms;
import java.io.*;
/**
*
* @author Geeky Keshav
*/
public class ReturnObject1
{
int a ;
int b;
int c;
ReturnObject1 num1 (ReturnObject1 s)
{
s.c=a*b;
return s;
}
void disp()
{
System.out.println("Multiplication of given two Numbers is: "+c);
}
}
class Return1
{
public static void main(String [] args)throws Exception
{
DataInputStream obj=new DataInputStream(System.in);
System.out.print("Enter first number: ");
int a2=Integer.parseInt(obj.readLine());
System.out.print("Enter second number: ");
int b2=Integer.parseInt(obj.readLine());
ReturnObject1 obj1=new ReturnObject1();
obj1.a=a2;
obj1.b=b2;
ReturnObject1 obj2=new ReturnObject1();
obj2=obj1.num1(obj1);
obj2.disp();
}
}
/*****OUTPUT****
Enter first number: 25
Enter second number: 2
Multiplication of given two Numbers is: 50
*/