Hi,
I'm new in
Java and I have a problem with the equals method. I have the following code:
boolean t=false;
t=bot.rotulo.equals("Configuraci�n");
System.out.println(bot.rotulo);
System.out.println(t);
if(bot.rotulo.equals("Configuraci�n"))
{
RecordStore rs=null;
String[] cdatos={"ak","gj"};
int edatos[]=new int[2];
byte datos[]=new byte[2];
cdatos[0]="aksdkfjr23445jdkls";
cdatos[1]="gjh5tf567jjdgop989";
try
{
rs = RecordStore.openRecordStore("bastidores",true);
System.out.println("record store bastidores opened.");
}
catch(Exception e)
{
System.out.println("Error: "+e.getMessage());
}
finally
{
try
{
rs.closeRecordStore();
System.out.println("record store bastidores closed");
}
catch (Exception e)
{
System.out.println("Error: "+e.getMessage());
}
}
try
{
rs = RecordStore.openRecordStore("bastidores",true);
rs.addRecord(datos,0,datos.length);
if(rs.getNumRecords()>0)
{
for(int i=0;i<=datos.length;i++)
{
datos=cdatos[i].getBytes();
rs.addRecord(datos,0,datos.length);
System.out.println(datos[i]);
}
}
}
catch(Exception e){}
finally
{
try
{
rs.closeRecordStore();
}
catch (Exception e){}
}
}
The problem is that the t value is false when I select Configuraci�n button. That is, I have three buttons in the screen that are Configuraci�n, Recuento and Sincronizaci�n. When I click in some of this buttons I always obtain the same result: false and the if code never is done.
Anyone knows why?
I also tried using the CompareTo method but the result is the same.
Thanks a lot.