Home > OS >  in java how can ı call a method like this ----->
in java how can ı call a method like this ----->

Time:12-05

public static int menus(String[]items,Scanner input) {}

we can call this for first part like that in main method

String[] Array ={"can","car","cam"};
        menus(Array,?);

but how can ı call second parameter(scanner input part) ?

CodePudding user response:

Instanciate a Scanner and pass it

String[] Array = {"can", "car", "cam"};
Scanner sc = new Scanner(System.in);
menus(Array, sc);
  • Related