es.davy.ai

Preguntas y respuestas de programación confiables

¿Tienes una pregunta?

Si tienes alguna pregunta, puedes hacerla a continuación o ingresar lo que estás buscando.

Tag: JAVA.UTIL.SCANNER

Usando getter y setter en el método principal

public class Testing { public static void main(String[] args) { String test = “test”; Scanner type = new Scanner(System.in); String theTest = type.next(); switch(theTest) { case “test”: int input = type.nextInt(); System.out.println(“OK”); } } } public class TestingB { private int finalInput; finalInput = input; // Quiero asignarle a finalInput . . . Read more

Cómo verificar si al final de una línea hay \n o \r o \r\n en JAVA

Necesito verificar cada carácter en el archivo y convertirlo en byte. Pero desafortunadamente, el escáner no ofrece ninguna posibilidad de no separar el último carácter de la línea… Intento hacer algo como esto: public static byte[] readFile(String path) throws FileNotFoundException { Scanner in = new Scanner(new File(path)); List<byte> byteList = . . . Read more