0

whats the problem?

this code is to print a 2D array. but here i used a method, and it didn't work... can you tell me how to make it work? code: import java.util.*; public class Main { public static void main(String[] args) { String[][] my2D = {{"pizza" , "burger" , "donut"} , {"milkshake" , "coffee" , "water"} , {"nike" , "adidas" , "puma"}}; Main.diamantion(my2D); } public static void diamantion(int x){ for (int i = 0; i < 3; i++){ for (int j = 0; j < 3; j++){ System.out.print(x[i][j] + " "); } System.out.println(); } } }

9th Jul 2020, 9:35 AM
Yahel
Yahel - avatar
2 Antworten
+ 1
In the function diamantion , your arguments ask for an integer but in Main you are passing a 2D string array.. Also please put a link of your code instead of copy pasting it https://code.sololearn.com/cMFRIAl97VJ3/?ref=app Have a good day, Ćheyat
9th Jul 2020, 9:42 AM
Saphal Poudyal
Saphal Poudyal - avatar
+ 1
Ćheyat , thank you! have a good day
9th Jul 2020, 9:45 AM
Yahel
Yahel - avatar