Olá, Hugo!
 
O método put da Hashtable não recebe (int,int), e sim Objects
 
By API:
 
put

public Object put(Object key,Object value)
 
Maps the specified key to the specified value in this hashtable. Neither the key nor the value can be null.
The value can be retrieved by calling the get method with a key that is equal to the original key.
 
Té+Ver
 
André Barbosa
 
 
----- Original Message -----
From: "Hugo Ribeiro" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 23, 2003 8:19 PM
Subject: [java-list] Hashtable - Nao sei onde estou errando...

> Ola pessoal,
> estou fazendo essa classe com hashtable, mas nao consigo compila-la...
> Alguem poderia me indicar o erro deste codigo, por favor?
>
> []s Hugo Ribeiro
>
> CLASSE:
>
> import java.util.*;
> import java.sql.*;
>
> public class TabTorres {  
>     Hashtable vTorre = new Hashtable();
>     Modulo1 md1 = new Modulo1();
>    
>     /** Creates a new instance of TabTorres */
>     public TabTorres() {
>     }
>    
>     private void limpaTabela() {
>         vTorre.clear();
>     }
>    
>     public void geraTabela(int chvemp, Connection cn) {
>         limpaTabela();
>         ResultSet rs;
>         String sql;
>         Object valor;   
>         sql = "select chave, numero from emprtorres where empreendimento = " + chvemp;
>         rs = md1.executaSql(sql, cn);
>         while (rs.next()) {
>             vTorre.put(rs.getInt("numero"), rs.getInt("chave"));
>         }
>     }
>    
>     public int getChave(int nm) {
>         return vTorre.get(nm);
>     }
> }
>
> ************************************************************
> ERROS:
>
> TabTorres.java [36:1] cannot resolve symbol
> symbol  : method put (int,int)
> location: class java.util.Hashtable
>             vTorre.put(rs.getInt("numero"), rs.getInt("chave"));
>                   ^
> TabTorres.java [41:1] cannot resolve symbol
> symbol  : method get (int)
> location: class java.util.Hashtable
>         return vTorre.get(nm);
>                      ^
> 2 errors
> Errors compiling TabTorres.
> ************************************************************
>
> ------------------------------ 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
> historico: http://www.mail-archive.com/java-list%40soujava.org.br
> para sair da lista: envie email para [EMAIL PROTECTED]
> -------------------------------------------------------------------------

Responder a