Guest User

isSmall with Return Value

a guest
Feb 12th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.47 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Program {
  4.  
  5.     public static void main(String[] args) {
  6.        
  7.         Scanner sc = new Scanner(System.in);
  8.         int input;
  9.        
  10.         System.out.println("Give me a number:  ");
  11.         input = sc.nextInt();
  12.    
  13.         if(isSmall(input)){
  14.             System.out.println("That's a small number.");
  15.         }
  16.         else{
  17.             System.out.println("That's not so small.");
  18.         }
  19.     }
  20.    
  21.     public static boolean isSmall(int i){
  22.         if(i <= 5)
  23.             return true;
  24.         else
  25.             return false;
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment