Java NoClassDefFoundError, Not Sure What's Wrong -
so i'm writing java program calculates difference between sum of squares of first 100 integers , square of sum of first 100 integers:
class project_euler6 { public static int sum_of_squares(int start, int end) { int total = 0; while (start <= end) { total += (start * start); start++; } return total; } public static int square_of_sums(int start, int end) { int total = 0; while (start <= end) { total += start; start++; } total *= total; return total; } public static void main(string[] args) { int first_total = sum_of_squares(1, 100); int second_total = square_of_sums(1, 100); int difference = math.abs(first_total - second_total); system.out.println("the difference between sum of squares , square of sums of first 100 integers " + difference); } }
when run it, strange error:
exception in thread "main" java.lang.noclassdeffounderror: project_euler6/java caused by: java.lang.classnotfoundexception: project_euler6.java @ java.net.urlclassloader$1.run(urlclassloader.java:202) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:190) @ java.lang.classloader.loadclass(classloader.java:306) @ sun.misc.launcher$appclassloader.loadclass(launcher.java:301) @ java.lang.classloader.loadclass(classloader.java:247)
not sure start on one...
any appreciated, mariogs
the problem not code nor access specifier class (public
not required before class name). actual problem how executing it. assume might have used java project_euler6.java
instead of java project_euler6
.
Comments
Post a Comment