Java if else statement used in restricting someone who's below 18 from entering an adult site | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Java if else statement used in restricting someone who's below 18 from entering an adult site

25th Oct 2016, 2:52 PM
Ojediran Philip
3 Answers
+ 3
For java, it should be, if(age<18) System.out.println("access restricted!"); else System.out.println("access granted"); P.S. Edited with corrected syntax
25th Oct 2016, 6:25 PM
Sumita Das
Sumita Das - avatar
+ 1
For java,it should be if (general) System.out.println("female "); else System.out.pribtln ("male");
19th Jan 2017, 9:07 AM
Shirisha Reddy
Shirisha Reddy - avatar
0
int age=12; if(age<18){ access_restricted(); }else{ access_granted(); }
25th Feb 2017, 6:01 AM
shobhit
shobhit - avatar