0

How to excute java program using yes or no statements

suppose if i enter yes in the cmd one statement should execute n if I enter no another statement should execute..provide me 1 example...

11th Jun 2017, 5:01 PM
Aneesh
1 ответ
+ 5
public static void main (String[] args) { if (args[0].equals("yes")) myYesMethod(); else if (args[0].equals("no")) myNoMethod(); } Something like that. You could use a switch/case statement as well.
14th Jun 2017, 7:12 PM
Tashi N
Tashi N - avatar