I understand that we have only seen the println() and print() methods, but why can't we use the format() method? It is easier to format strings, and the output would be the same as using println(" " + " ").
package com.codegym.task.task04.task0410;
/*
Come on, lucky seven!
*/
public class Solution {
public static void main(String[] args) {
checkInterval(60);
checkInterval(112);
checkInterval(10);
}
public static void checkInterval(int a) {
//write your code here
if(a >=50 && a <= 100){
System.out.format("The number %d is in the interval.\n", a);
}
else
System.out.format("The number %d is not in the interval.\n",a);
}
}