27.4k views
1 vote
A program that contains the following method: public static void display(int arg1, double arg2, char arg3) { System.out.println("The values are " + arg1 + ", " + arg2 + ", and " + arg3); } Write a statement that calls this method and passes the following variables as arguments: char initial = 'T'; int age = 25; double income = 50000.00;

1 Answer

2 votes

Answer:

The method can be accessible from main method of any class.

Step-by-step explanation:

Main method is the entry point of a program, which means when you start you program the first thing to execute is the main method.

public static void main(String[] args){

// Your code here

}

In the given display method you have int, double and char data types as a arguments. So in order to call display method you need to understand the datatype that you want to pass.

int only takes integers without decimal points.

double take numbers with decimal points.

and char only tak one character

so in order to call display method we need to pass those arguments in right order.

Below is the main method which will call the display method in a right way

public static void main(String[]args){

display(25,50000.00,'T');

}

Output

The values are 25, 50000.0, and T

User Srinivas Guni
by
5.5k points