According to this answer, getClass().getName()
should give me the solution. I'm not sure why this is not working.
Error:
/tmp/java_i8lW4s/HelloWorld.java:35: error: cannot find symbol
System.out.print(z.class.getName());
^
symbol: class z
location: class HelloWorld
1 error
Code:
public class HelloWorld
{
public static void main(String[] args)
{
int x, y;
double z;
x = 10;
y = 5;
z = 10 / 5;
System.out.print(z.getClass().getName());
}
}