Help with NoClassDefFound error!
Like everyone here, I'm a Java newbie. I've only been learning it for 3 days (my previous language being GML, so I'm making quite a transition) from a book. The book told me to print the first 5 rows of Pascal's Triangle to the screen and detirmine the values mathematically.
When running my program:
/*
* PascalsTriangle.java
* PRINTS THE FIRST 5 LINES OF PASCALS TRIANGLE
* Derives values mathematically!
*/
import java.io.*;
import java.lang.*;
publicclass PascalsTriangle
{
publicstaticvoid main(String args[])
{
//declare Countd
boolean Countd =false;
//declare arrays
int[] Rowo ={ 1, 2};
int[] Rowt ={ Rowo[1], Rowo[1]};
int[] Rowth ={ Rowt[1], Rowt[1] + Rowt[2], Rowt[1]};
int[] Rowfo ={ Rowth[1], Rowth[1] + Rowth[2], Rowth[2] + Rowth[3], Rowth[3]};
int[] Rowfi ={ Rowfo[1], Rowfo[1] + Rowfo[2], Rowfo[2] + Rowfo[3], Rowfo[3] + Rowfo[4], Rowfo[4]};
//draw triangle while mathematically calculating
for (int Count = 0; Countd ==true ; Count++)
{
if (Count == 0)//Row 1
{
System.out.println(Rowo[1]);
}
if (Count == 1)//Row 2
{
System.out.println(Rowt[1] +"" + Rowt[2]);
}
if (Count == 2)//Row 3
{
System.out.println(Rowth[1] +"" + Rowth[2] +"" + Rowth[3]);
}
if (Count == 3)//Row 4
{
System.out.println(Rowfo[1] +"" + Rowfo[2] +"" + Rowfo[3] +"" + Rowfo[4]);
}
if (Count == 4)//Row 5
{
System.out.println(Rowfi[1] +"" + Rowfi[2] +"" + Rowfi[3] +"" + Rowfi[4] +"" + Rowfi[5]);
}
if (Count == 5)//End
{
Countd =true;
}
}
}
}
I get the error:
Exception in thread"main" java.lang.NoClassDefFoundError: PascalsTriangle/class
It has me stumpted. Could you tell me what's wrong with my code?
Also, once that problem is away, could you give me hints on making my code better and more efficient? I know I could have used the switch statement instead of multiplule ifs.
Thanks! ;)

