26th Sep 2024, 12:26 PM
IFEANYICHUKWU HENRY OKWOR
IFEANYICHUKWU HENRY OKWOR - avatar
4 Respostas
+ 2
For starters, you named your function conv(). But when you try to call it, you use convert(). Secondly, you are not passing any parameters to convert() when you do call it. That function is expecting a double and an int. You declared two ints, x & y, one needs to be a double. 1. Rename your function to convert 2. Change int x to double x 3. Pass those to the function call: convert(x, y) static void conv(double x,int y){ double res= x*12; System.out.println(res); } public class Program { public static void main(String[] args) { int x = 12; int y = 6; convert(); } }
26th Sep 2024, 1:04 PM
Jerry Hobby
Jerry Hobby - avatar
+ 2
The static method should also be within the class, and not outside the class.
26th Sep 2024, 6:22 PM
Jan
Jan - avatar
+ 1
I copied your code only to highlight where the problems were. I did not write your solution. I explained your mistakes. That is your code.
27th Sep 2024, 1:36 AM
Jerry Hobby
Jerry Hobby - avatar
0
Jerry Hobby Ur code is what I wrote before
26th Sep 2024, 6:32 PM
IFEANYICHUKWU HENRY OKWOR
IFEANYICHUKWU HENRY OKWOR - avatar