Answer:
The program to this question as follows:
Program:
public class DataTransmitter //defining class
{
double x=3.0; //define variable x.
public static void sendDouble(double x) //define method sendDouble.
{
x=9.6; //change variable value
System.out.print("The value of x variable is :"+x); //print value.
}
public static void main(String[] args) //define main method
{
sendDouble(0.0); //calling function
}
}
Output:
The value of x variable is :9.6
Explanation:
The explanation of the above java program can be define as follows:
- In the above java program a class is define that is "DataTransmitter" inside a class a double variable that is x is define which contain a double value that is "3.0".
- In this class, a static method "sendDouble()" is defined. in the method, a double parameter is passed. inside a method, we change the variable value and print its value.
- In main method is a sendDouble() function is called. In calling time a double value is passed in the function parameter.