method to receive double and boolean | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 7

method to receive double and boolean

can a method receive both a double and a boolean? How to write it? I understand that public static void Name(double n) // to receive double but what if the method needs to receive a boolean too?

6th Dec 2018, 12:01 PM
Poo
3 Answers
+ 11
Just define a function with multiple parameters! :> public static void Name(double n, boolean b) { ... }
6th Dec 2018, 12:02 PM
Hatsy Rei
Hatsy Rei - avatar
+ 3
Use casting method
8th Dec 2018, 7:37 AM
Gokul S
Gokul S - avatar
+ 2
You can of course have multiple parameters each of different kind Like. void function_name(boolean parm1, double parm2){ // your code }
7th Dec 2018, 4:11 AM
Shreyansh
Shreyansh - avatar