Aprender Java
Preguntas y Problemas
¿Cómo leer un archivo en Java?
Podemos leer un archivo usando la clase Scanner
de la siguiente manera:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//crear | |
Scanner in; | |
try{ | |
in = new Scanner(new File("archivo.txt")); | |
}catch (FileNotFoundException e1){ | |
//codigo... | |
} | |
//Leer datos | |
try{ | |
String s=in.nextLine(); | |
}catch (NoSuchElementException e2){ | |
}catch (IllegalStateException e3){ | |
} |
¿Cómo pedir un String con JOptionPane?
Un ejemplo sencillo es el siguiente:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.swing.JOptionPane; | |
public class Main { | |
public static void main(String args[]) { | |
String nombre | |
= JOptionPane.showInputDialog("Ingrese su nombre:"); | |
JOptionPane.showMessageDialog(null, "Hola " + nombre, "Bienvenido", | |
JOptionPane.PLAIN_MESSAGE); | |
// el primer algumento ( null ) indica la posicion , null indica | |
// el centro de la pantalla | |
} | |
} |
Links:
- Pandas en Python, con ejemplos -Parte I- Introducción - https://jarroba.com/pandas-python-ejemplos-parte-i-introduccion/
- Loading A CSV Into Pandas - https://chrisalbon.com/python/pandas_dataframe_importing_csv.html
- Python Pandas - DataFrame - https://www.tutorialspoint.com/python_pandas/python_pandas_dataframe.htm
- https://es.wikipedia.org/wiki/NumPy
- https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.where.html
- https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.concatenate.html
- http://docs.python.org.ar/tutorial/3/classes.html
- http://docs.python.org.ar/tutorial/2/classes.html
- http://www.cristalab.com/tutoriales/crear-matrices-en-python-utilizando-listas-c103122l/
- http://fitoria.net/2011/11/django-suite-iii-usand-virtualenv-y-pip.html
- https://stackoverflow.com/questions/231767/what-does-the-yield-keyword-do
- http://docs.python.org.ar/tutorial/3/datastructures.html
No hay comentarios.:
Publicar un comentario