Skip to content

Instantly share code, notes, and snippets.

@uncoded-ro
Last active January 13, 2020 04:53
Show Gist options
  • Save uncoded-ro/5b3c5df038dccae27aba0b15cda0d255 to your computer and use it in GitHub Desktop.
Save uncoded-ro/5b3c5df038dccae27aba0b15cda0d255 to your computer and use it in GitHub Desktop.
class Casting {
public static void main(String[] args) {
// conversie implicita
double media;
int a = 43;
short b = 15;
media = (a + b) / 2;
System.out.println("Media = " + media);
// conversie explicita
char c = 'a';
int d = 99;
System.out.println("Conversie de la char la int: " + (int) c);
System.out.println("Conversie tip de la int la char: " + (char) d);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment