-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclaseProfesor.java
More file actions
88 lines (59 loc) · 2.48 KB
/
claseProfesor.java
File metadata and controls
88 lines (59 loc) · 2.48 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package claseProfesor;
public class claseProfesor {
public static void main(String[] args) {
// Uso de la instrucción print
System.out.println("Hola");
System.out.printf("El valor es %.3f %n", 12.3698);
// Imprimir mas de una variable
double n = 1.25036;
int x = 10;
System.out.printf("n = %.2f x = %d %n", n, x);
System.out.println("\u2605");
System.out.printf("hola %10s %n","hola");
String fmt = "%-30s %-20s %-20s %n";
System.out.printf(fmt, "Libros", "Autor", "Precio");
System.out.printf(fmt, "-----", "------", "-----");
System.out.printf(fmt, "Matematicas", "Navathe", "80.000");
System.out.printf(fmt, "Algoritmos", "Cormen", "92.250");
System.out.printf(fmt, "Introducción al cálculo", "Rajib Mall", "75.000");
System.out.printf("%-30s %-20.2f %-20d \n", "Libros", 5.3596, 456);
int a=0;
a+=2;
int y = 0; // y = 0
y = y + (a--); // y = 0 + 2 tambien a a le resta 1.
System.out.println("\n a= "+ a);
int t=0;
t = t + (++a);
System.out.println("y= "+ y);
System.out.println("t= "+ t);
System.out.println("a= "+ a);
boolean d = (t==2);
System.out.println("d= "+ d);
String texto ="hola";
System.out.println(texto.equals("hla")); // texto == "hola"
System.out.println("hola".equals("hla")); // texto == "hola"
String fruta="Pera";
if (fruta.equals("Manzana")){
System.out.println("Es una manzana");
}else{
System.out.println("No es una manzana");
}
if(1==2){
System.out.println("Es falso");
}else{
System.out.println("Es verdadero");
}
String mes= "Marzo";
switch(mes){
case "Enero":
System.out.println("Cumplen años: Juan y Pedro");
break;
case "Febrero":
System.out.println("Cumplen años: Lina y David");
break;
case "Marzo":
System.out.println("Cumplen años: Dubian y David");
break;
}
}
}