Professional Documents
Culture Documents
Java Resumen
Java Resumen
Variables:
INPUT:
AND/OR:
• AND in Java: &&
• OR in Java: ||
LOOP (FROM TO) FOR: Known number of repetitions
1 +(int)(Math.random()*((10 - 1) + 1))
LOOP WHILE: Unknown number of repetitions
ARRAYS:
Inicializarla: int a [ ] = new int [number of element]
a = name of the array
int = type of each element
METODOS:
Method rules:
Starts with a lower case letter
Ends with a set of brackets: ()
Has to say what comes back
Methods that return a value are called return type methods.
You have to specify what type of data is being returned: int, String, char, etc.
Methods that don’t return a value are called void methods.
Some people call void methods procedures and return type methods
functions
ARCHIVOS:
There are two types of files in computing:
Text files (that contain ASCII/Unicode characters) – e.g. TXT, CSV
Random Access Files (that contain binary objects) – e.g. JPG, MP3
Setting up the file connection
Steps to remember:
1. Import: java.io.*
2. Throw away any IOExceptions (throws IOException) that could
potentially occur in the main method
Connecting to the file
Steps to remember:
1. First add a File Reader
2. Then add that File Reader to a Buffered Reader