Hi all,
Im trying to remove from a HashTable by providing key and to get by proving key.
And i tried as follows for removing,
Caharcter ch=p.charAt(i);
but gives these errors.
myOwnBm.java:60: cannot find symbol
symbol : method Remove(char)
location: class java.util.Hashtable
myHash.Remove(p.charAt(i));
^
myOwnBm.java:77: inconvertible types
found : java.lang.Object
required: int
int v=(int)myHash.get(c);
this is my code for remove
Error in line 10
Hashtable myHash=new HashTable();
public void preprocess(String p)
{
for (int i=0;i<p.length();i++)
{
if (myHash.containsKey(p.charAt(i)))
{
myHash.Remove(p.charAt(i));
myHash.put(p.charAt(i),i);
}
else
{
myHash.put(p.charAt(i),i);
}
}
}
this is my code to get.
i tried
int value=(int)
Error in line 6
public int getLastOccurance(char c)
{
if (myHash.containsKey(c))
{
int v=(int)myHash.get(c);
return v;
}
else
{
return -1;
}
}