Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

in java how can ı call a method like this —–>

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) ?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Instanciate a Scanner and pass it

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

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading