Skip to content

Instantly share code, notes, and snippets.

@edinak1
Created October 23, 2015 09:59
Show Gist options
  • Select an option

  • Save edinak1/79c7a0093c67410ffcb0 to your computer and use it in GitHub Desktop.

Select an option

Save edinak1/79c7a0093c67410ffcb0 to your computer and use it in GitHub Desktop.
package metod;
public class Old {
public static void main(String[] args) {
int age=212;
if(age>150 || age<=0)
System.out.println("Age are not correct");
else
System.out.println(oldEnough(age));
//////////////////////////////////////////////
age=-5;
if(age>150 || age<=0)
System.out.println("Age are not correct");
else
System.out.println(oldEnough(age));
//////////////////////////////////////////////
age=25;
if(age>150 || age<=0)
System.out.println("Age are not correct");
else
System.out.println(oldEnough(age));
//////////////////////////////////////////////
age=12;
if(age>150 || age<=0)
System.out.println("Age are not correct");
else
System.out.println(oldEnough(age));
}
static boolean oldEnough(int age)
{
if(age>=21 && age<150)
return true;
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment