IMPURE METHOD EXAMPLE PROGRAM
JAVA
Answers
Answered by
5
Program: {JAVA}
public class Impure
{int num;
public int get(int n)
{ num=num+n;
return num; }
public void main()
{
int result;
System.out.println("Value Befor calling="+num);
result=get(10);
System.out.println("Result after calling="+result);
System.out.println("Value After calling="+num);
result=get(20);
System.out.println("Result after calling="+result);
}}
Similar questions