This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//this method returns director's name of a serie | |
public String directorName() { | |
return "Director's name is " + name; | |
} | |
/*I want print like this | |
*Directo's name is "Carlos" */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PruebaDeConstructor { | |
public static void main(String[] args) { | |
// TODO Auto-generated method stub | |
ClaseSinConstructor prueba=new ClaseSinConstructor(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ExamplenEncapsulate { | |
public static void main(String[] args) { | |
Car ford= new Car(); | |
ford.wheel=5; | |
//wrong way, you cannot modify wheel outside the class. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package graficos; | |
public class ContraAleatoria { | |
public static void main(String[] args) { | |
String[] letras = { "a", "b", "c", "d", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", | |
"t", "u", "v", "w", "x", "y", "z" }; | |
int[] numeros = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package layout; | |
import javax.swing.*; | |
import java.awt.*; | |
public class Layouts { | |
public static void main(String[] args) { | |
// TODO Auto-generated method stub | |
Marco marco=new Marco(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package layout; | |
import javax.swing.*; | |
import java.awt.*; | |
public class Caculadora { | |
public static void main(String[] args) { | |
// TODO Auto-generated method stub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package graficos; | |
import java.awt.*; | |
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
import javax.swing.*; | |
public class Lamina extends JPanel { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hay ciertas reglas y conveniencias a la hora de nombrar los identificadores en Java, puedes omitir todo lo que vas a leer a continuación y tu programa funcionara correctamente, pero estas reglas existen para que sea mas fácil leer el código fuente a medida que el programa se va haciendo más complejo, para facilitar la lectura del código a otros programadores que no sean el autor o para recordar a posteriori al autor que hace cada variable/constante/clase etcetera... | |
Tipo: Conveniencia: Ejemplo: | |
Clases: La primera letra en mayúscula, si tú clase tiene más de una palabra, Carro Casa | |
la primera letra de la siguiente palabra se escribe en mayúscula. CarroSedan CasaVerano | |
Paquetes: Todo en minúscula, si tú paquete tiene más de una palabra, se escribe un punto y la siguiente palabra graficos | |
se escribe toda en minús |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<conio.h> | |
int main(){ | |
int edad1,edad2,edad3; | |
float promedio; | |
printf("Introduce una edad: "); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package colecciones; | |
import java.util.*; | |
public class HashMapPruebas { | |
public static void main(String[] args) { | |
// TODO Auto-generated method stub | |
HashMap<String, Empleado> personal=new HashMap<String,Empleado>(); | |
personal.put("1", new Empleado("Iván")); |
OlderNewer