-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathTipos.java
More file actions
63 lines (51 loc) · 1.54 KB
/
Tipos.java
File metadata and controls
63 lines (51 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
public class Tipos {
public static void main(String[] args) {
// tipos de Datos
// Primitivos
// Tipo de dato findamental que no es un objeto y no requiere
// ser instanciado para ser usado.
// int o Integer
// rango de valores de
// -2.147.483.648 a 2.147.483.647
// decimal
// 32 bits
int numero = 10;
int numero2 = -90;
// float o Flotante
// agrega Soporte a un valor decimal
// Rango de valores
// 1.4e-45 a 3.4e38
// 32 bits
float numeroFloat = 3.1416f;
// double
// rango de valores
// 4.9e-324 a 1.8e308
// 64 bits
double pi = 3.141592654;
// char
// caracter
// 0 a 65535 en valor decimal
// 16 bits
char letra = 'A';
// Boolean
// Representados para valores verdadros y falsos
// Controlar flujos de ejecución de unprpgrama - if, while y un dow while.
boolean hoyDesayune = true;
// Tipos de dato de referencia
// String
String alumna = "Ana Jael";
String aluman2 = "Guadalupe Crespo";
// Array
// Arreglos
int[] numeros = new int[5];
numeros[0] = 10;
numeros[1] = 20;
numeros[2] = 30;
numeros[3] = 40;
numeros[4] = 50;
numeros[5] = 60;
for (int i = 0; i < numeros.length; i++){
System.out.println("Elemento indice "+i + " Valor en el arreglo "+numeros[i]);
}
}
}