My Java is pretty rough. So far I've completed one class of Java all the way up to basic array functions. I've asked my Professor to explain it, but he talks with so much jargon. Could someone explain to me why this program spits out the "24" when I run it? O.o
I learned when changing any of the numbers, at least at the bottom (8,4,2), to '0', I get an error of "dividing by zero". But I couldn't figure out how that worked.
//#2 from Spring 2011 Test #2
public class T1b
{
protected int a;
public T1b(int aIn)
{
a=aIn;
}//Constructor
public int f(int b, int c)
{
return a*b/c;
}//f()
}//class T1b
class D extends T1b
{
protected int third;
public D(int a)
{
super(a+1);
third = a/3;
}//Constructor
public int g(int x)
{
return f(x, x/2);
}//g()
}//class D
class E extends D
{
public E(int z)
{
super(z);
}//Constructor
public int f(int b, int c, int d)
{
return super.f(b,c) +g(d);
}//f()
public static void main (String[]args)
{
E e = new E(5);
System.out.println(e.f(8,4,2));
}//main()
}//class E