I ask for help please; I need to extract two different positions of the same string with the substring () method of java, but it generates an error.
package Entradas;
import java.util.Scanner;
public class Ejer20_parqueadero
{
public static void main(String[] args)
{
double horaEntrada, horaSalida;
String entrada="",salida="";
System.out.println("Ingrese hora militar: ");
Scanner hora=new Scanner(System.in);
entrada=hora.nextLine().substring(0,2);
salida=hora.nextLine().substring(3,5);
System.out.println("entrada: "+entrada+" salida: "+salida);
}
}