I'm starting to program in java, novice in this language, I'm doing a cinema seating assignment program, which I'm doing with a matrix of dimension 6, but when comparing the matrices with a character it performs well but I enter || (or) to compare it with another character and I get an error.
int f = 5, c = 5; String [] [] seat = new String [f] [c]; int option, purchase, acomular;
for (f=0;f<asiento.length;f++)
{
for (c=0;c<asiento.length;c++)
{
asiento[f][c]= ("L") ;
}
}
for (f=0;f<asiento.length;f++)
{
for (c=0;c<asiento.length;c++)
System.out.print("["+asiento[f][c]+"]");
System.out.println(" ");
}
System.out.println();
do{
opcion=Integer.parseInt(JOptionPane.showInputDialog("Menùº:\n 1.Reservar\n 2.Comprar\n 3.Liberar\n 4.Salir\n Ingrese la opciòn deseada:\n"));
switch(opcion){
case 1: f=Integer.parseInt(JOptionPane.showInputDialog("Ingrese la fila:"));
c=Integer.parseInt(JOptionPane.showInputDialog("Ingrese la columna:"));
if (asiento[f][c]=="L" || "R") (me sale error y ya probado con varios metodos y no da)
{
asiento[f][c]= ("V") ;
System.out.println("Asientos ");
System.out.println();
for (f=0;f<asiento.length;f++)
{
for (c=0;c<asiento.length;c++)
System.out.print("["+asiento[f][c]+"]");
System.out.println(" ");
}
}
break;
I would like to know how you can compare a matrix with two characters.