-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJavaVariables.java
More file actions
28 lines (19 loc) · 942 Bytes
/
JavaVariables.java
File metadata and controls
28 lines (19 loc) · 942 Bytes
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
public class JavaVariables {
public static void main(String[] args){
//En Java hay varia variables de distintos tipos, cada uno retiene diferentes tipos de datos
String primeraVariable = "Mi primera variable";
System.out.println(primeraVariable);
int miNumero = 25;
System.out.println(miNumero);
/*Los String almacenan lineas de texto, mientras que los int almacenan enteros
mientras que los float y double pueden almacenar numeros con decimales
*/
Boolean JavaEsDivertido = true;
System.out.println(JavaEsDivertido);
char LetraA = 'a';
System.out.println(LetraA);
//Los boolean almacenan valores positivos o negativos y los char almacenan un unico caracter
final double Constante = 3.14;
//Se pueden declarar variables finales poniendo final comienzo, estas variables no podran ser modificadas
}
}