CGIS IP T1 TiposVariablesOperadores
CGIS IP T1 TiposVariablesOperadores
Examples
– Automate mathematical operations
– Process data
– Create and play around with objects
– Draw some graphics
Memory
Central
Processing Unit
(CPU)
Input/Output
(IO) Devices
Write to location z
Compilador Java
Interprete de Java
ByteCodes interpretados
(ejecutados)
class Hello {
public static void main(String[] arguments)
{
// Program execution begins here
System.out.println("Hello
world.");
}
}
class CLASSNAME {
public static void main(String[]
arguments) {
STATEMENTS
}
}
Example:
– System.out.println(“output”);
class Hello2 {
public static void main(String[] arguments) {
System.out.println("Hello world."); // Print once
System.out.println("Line number 2"); // Again!
}
}
Start with lower case and use an upper case for every new “word”
– Use intuitive and significative names for variables
foo
Example:
String foo;
foo = "IAP 6.092";
foo
“IAP 6.092”
Example
double badPi = 3.14;
boolean isJanuary = true;
– Combined arithmetic
Relational
Logical
A B A OR B A B A AND B A NOT A
F F F F F F F V
F V V F V F V F
V F V V F F
V V V V V V
2. Arithmethic operators
1. Multiplication and division
2. Addition and subtraction
3. Relational operators
4. Logic operators
Expresión Resultado
(i >= 6) && (c == ‘w’)
(i >= 6) || (c == 119)
i + f <= 10
c != ‘p’ || i + f <= 10