ho fatto qualche passo avanti col problema del dover trovare il maggiore e minore tra tre numeri. ecco il codice aggiornato
codice:package maggioreminore; import java.io.*; /** * * @author filipporezzadore */ public class Maggioreminore { /** * @param args the command line arguments */ public static void main(String[] args) throws Exception { int a; int b; int c; int max; int min; System.out.println("Inserire in numero A"); BufferedReader input = new BufferedReader( new InputStreamReader(System.in)); String line = input.readLine(); a = Integer.parseInt(line); line = input.readLine(); b = Integer.parseInt(line); line = input.readLine(); c = Integer.parseInt(line); if (b > a) b = max; if (c > max) c = max; if (b < a) b = min; if (c < min) c = min; System.out.println("Largest of the three numbers is " + max); System.out.println("Smallest of the three numbers is " + min); // TODO code application logic here } }
mi dà errore su i termini "max" e "min" : variabile max might not have been initialized. e variable min might not have been initialized
perché???