Logo

Programming-Idioms

History of Idiom 94 > diff from v9 to v10

Edit summary for version 10 by :
New Java implementation by user [javasucks]

Version 9

2016-02-16, 19:46:07

Version 10

2016-02-17, 10:08:45

Idiom #94 Print type of variable

Print the name of the type of x. Explain if it is a static type or dynamic type.

This may not make sense in all languages.

Idiom #94 Print type of variable

Print the name of the type of x. Explain if it is a static type or dynamic type.

This may not make sense in all languages.

Code
int a = 0;
String b = "str";
		System.out.println(((Object)a).getClass().getName());
System.out.println(b.getClass().getName());
Doc URL
https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html