Boa Tarde Roberto.

Neste caso voc� deve garantir ao compilador que as vari�veis a e b sejam
inicializadas

troque:   int a, b;
por:       int a = 0, b = 0;

Abra�os!!!

----- 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 ???


> Acesso pelo menor pre�o do mercado! R$ 14,90 nos 3 primeiros meses!
> ASSINE AGORA! http://www.bol.com.br/acessobol/
>
>
> 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