Visualizzazione dei risultati da 1 a 10 su 11

Visualizzazione discussione

  1. #1

    aiuto problema "max" - "min" aggiornato

    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é???
    Ultima modifica di LeleFT; 13-01-2015 a 11:25 Motivo: Aggiunti i tag CODE

Tag per questa discussione

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.