+ 1
What’s the problem??
2 Respuestas
+ 2
import java.util.Scanner;
public class Program
{
public static void main(String[] args) {
Scanner Y=new Scanner(System.in);
double a=Y.nextDouble();
double b=Y.nextDouble();
if(b>a){System.out.println("Your father is your father");}else if(a>b||a==b){System.out.println("You are Your father!");}
}
}
+ 2
Mostafa_tco ill assume the last guy answered your question but ill share a little knowledge with you their are different kinds of classes, utility classes, helper classes and factory classes. there are a few differences between these, like how many objects should be created of them. Scanner is a utility class and utility classes commonly only need 1 object instance. you can use the many methods of the Scanner class and assign the result to different variables while never creating another object from the class. now there are times when you will want more than one object so say you have a Person class each person will be a new Person object with their own names and nationalities these are commonly known as a factory class. :) a lot of the classes in the java library are utility style classes meant to help you out in some way or another. hope this helps a little!