Java/Conversão de tipos

De String para tipo básico editar

int num = Integer.parseInt(numInt);
double num = Double.parseDouble(numDou);

Implícitas

Entre inteiros: tipos menores para tipos maiores;
byte b = 10; short s = 10; int i = 10; long l = 10;
s = b; i = b; i = s; l = b; l = s; l = i;
i = 10; l = 100;

Explícitas

Type Casting
varTipo1 = (tipo1) varOuValTipo2;

Entre inteiros: tipos maiores para tipos menores;

byte b = 10; short s = 10; int i = 10; long l = 10;
b = (byte) s; b = (byte) i; s = (short) i; b = (byte) l; s = (short) l; i = (int) l;
b = (byte) 10; s = (short) 10;

Cuidado para que o valor que está sendo atribuído não extrapole o tamanho máximo possível do tipo que está recebendo.