Inicialize suas vari�veis, no caso, a e b

se for double

double nomevariavel = valorinicial;
Exemplo:
double a = 0;

se for int

int nomevariavel = valorinicial
Exemplo:
int b = 0;

----- Original Message -----
From: "Roberto A. Metz" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, May 21, 2001 12:47 PM
Subject: [java-list] Sobrecarga de Metodos ???


> Boa tarde ...
> Estou tentando fazer um pequeno programa que usa sobrecarga de metodos,
mas
> impaquei num erro:
> --------------------------- Compiler Output ---------------------------
> Folha3.java:15: variable a might not have been initialized
>  System.out.println( SobreCarga.multiplica ( a, b ) );
>                                                     ^
> Folha3.java:15: variable b might not have been initialized
>  System.out.println( SobreCarga.multiplica ( a, b ) );
>                                                        ^
> 2 errors
> --------------------------------------------------------------------------
--
> -
>
> Porque n�o inicialiadas? O que eu fiz de errado com as variaveis?
> Conto com ajuda dos mestres ...
>
>
> public class SobreCarga
> {
>  public static double multiplica (int a, int b)
>  {
>   double total = ( a * b );
>   return total;
>     }
>
>  public static double multiplica (double a, double b)
>  {
>   double total = ( a * b );
>   return total;
>
>     }
>
>  public static double multiplica (int a, double b)
>  {
>   double total = ( a * b );
>   return total;
>     }
> }
>
> public class Folha3
> {
>
>  public static void main (String[] args)
>
>
>
>  int a, b;
>
>  if (args.length > 0)
>    {
>     a = Integer.parseInt(args[0]);
>     b = Integer.parseInt(args[1]);
>    }
>
>  System.out.println( SobreCarga.multiplica ( a, b ) );
>  System.out.println( SobreCarga.multiplica ( a, b ) );
>  System.out.println( SobreCarga.multiplica ( a, b ) );
>
>     }
> }
> =================================
> Roberto A. Metz
> Universidade de Passo Fundo - RS
> [EMAIL PROTECTED]
> http://carazinho.upf.tche.br/~9430
> =================================
>
>
> ------------------------------ LISTA SOUJAVA ----------------------------
> http://www.soujava.org.br  -  Sociedade de Usu�rios Java da Sucesu-SP
> d�vidas mais comuns: http://www.soujava.org.br/faq.htm
> regras da lista: http://www.soujava.org.br/regras.htm
> para sair da lista: envie email para [EMAIL PROTECTED]
> -------------------------------------------------------------------------
>
>


------------------------------ LISTA SOUJAVA ---------------------------- 
http://www.soujava.org.br  -  Sociedade de Usu�rios Java da Sucesu-SP 
d�vidas mais comuns: http://www.soujava.org.br/faq.htm
regras da lista: http://www.soujava.org.br/regras.htm
para sair da lista: envie email para [EMAIL PROTECTED] 
-------------------------------------------------------------------------

Responder a