# CLASE PmyDM (Gilbert)
###### tags: `RET`
Descargar
https://www.jetbrains.com/es-es/idea/download/#section=windows
Compilador online JAVA
https://www.onlinegdb.com/online_java_compiler

Todo programa empieza por un main.java que es el punto de entrada que es el metodo o funcion main.java
Para poner comentarios se hace con //
Hemos dado:
* println
* comentarios
* if
* else if
* else
* operaciones arimeticas
** entero (int numeros enteros)
** doble (double para cuando tenga decimales)
string es una clase e int es un tipo primitivo como "float ,double ,boolean ,char ,long , short, byte".
**PRIMER EJERCICIO HECHO EN CLASE**
```java=
public class Main
{
public static void main(String[] args) {
/* System.out.println("Daniel");
System.out.println("Gonzalez");
System.out.println("Carreras");
System.out.println("Daniel"+"\n"+"Gonzalez"+"\n"+"Carreras");*/
int nNumero = 40;
int nNumero1 = 5;
int resultado = 0;
resultado = nNumero + nNumero1;
System.out.println("La suma es "+ resultado);
resultado = nNumero - nNumero1;
System.out.println("La resta es "+ resultado);
resultado = nNumero * nNumero1;
System.out.println("La multiplicacion es "+ resultado);
resultado = nNumero / nNumero1;
System.out.println("La division es "+ resultado);
System.out.println("La multiplicacion es "+ nNumero * nNumero1);
System.out.println("La division es "+ nNumero / nNumero1 );
// en que posicion esta el espacio
String nombre = "jorge Maset Suanzes";
System.out.println (nombre.indexOf(" ")+ 1);
/*if(nNumero<5)
{
System.out.println("Es menor que 5");
}
else if(nNumero>5)
{
System.out.println(" NO es menor que 5");
}
else (nNumero==5)
{
System.out.println("es igual que 5");
}*/
}
}
```
**EJERCICIO**
Hay que utilizar lo siguiente:
```java=
String sP = "HOLA MUNDO";
```
//PASAR A OTRO STRING PERO EN MINUSCULA
```java=
String sPMin = sP.toLowerCase();
System.out.println(sPMin);
```
// IMPRIMIR EL NUMERO DE CARACTERES DEL STRING
```java=
System.out.println(sP.length());
```
// IMPRIMIR LO QUE HAY DESPUES DEL ESPACIO
```java=
int nPosicionEspacio = sP.indexOf(" ");
String sDos = sP.substring (nPosicionEspacio+1,sP.length());
System.out.println(sDos);
```
//ESCRIBIR 10 VECES UNA FRASE
```java=
for (int i = 0; i < 10; i=i+i)
{
System.out.println("NO ME ....");
}
```
//QUE ME ESCRIBA LOS NUMEROS NATURALES DEL 1 AL 15
```java=
for (int i = 0; i < 15 ; i++)
{
System.out.println(i+1);
}
```
//QUE ME ESCRIBA LOS NUMEROS NATURALES DEL 15 AL 1
```java=
for (int i = 15; i > 0 ; i--)
{
System.out.println(i);
}
```
//IMPRIMIR LOS NUMEROS PARES ENTRE EL 1 Y 200
```java=
for (int i = 0; i < 200 ; i--)
{
System.out.println(i+1);
}
```
//CONTAR EL NUMERO DE "e" EN UN TEXTO
```java=
```
//CUENTA EL NUMERO DE PALABRAS QUE SE REPITEN
```java=
String sNombre = "alb erto fer alf al7 dez dez alb san chez";
```
//CONTAR EL NUMERO DE PALABRAS QUE SE REPITEN
```java=
String sAux [] = sNombre.split( regex " ");
int cont = 0;
for (int i = 0;1< sAux.length;i++)
{
for (int i = 0; i < sAux.length; i++){
if (sAux[i].equals(sAux[i]) && i != j && bAux[i]){
bAux[i] = true;
cont++;
}
}
}
System.out.println("La palabra se repite " +cont+" veces");
```
//QUE SOLO IMPRIMA LAS COMAS NECESARIAS
```java=
String sComma = "";
for (Integer numeroI:alNumerosImpares);
{
System.out.print(sComma+numeroI);
sComma=",";
}
```
//imprimir las peliculas 3,4 y 5
```java=
```