Reputation: 697
Can someone please explain why this is not working? can you not run a method that belongs to the same class? I have been going at this for a while and my brain is just starting to hurt. Thank you in advance.
My error im getting is "Exception in thread 'main' java.lang.NoClassDefFoundError: dProb (wrong name:DProb)" its not a compile error though. its when i try to pass the variables.
public class DProb{
public static double Combinations(long N, long X){
double comb = 0.0;
long n = N;
long r = X;
long denom;
if(n==r || r == 0)
n = 1;
else{
denom = n-r;
for(long i = n; i > denom; i--){
if (i == n){}
else
n *= i;
}
for (long i = r; i > 0; i--){
if (i == r){}
else
r *= i;
}
n = n/r;
}
comb = n;
return comb;
}
public static double HyperGeometric(long Np, long Xp, long N, long X){
double probX = 0.0;
double leftNum = Combinations(N,X);
return probX;
}
}
Upvotes: 0
Views: 215
Reputation: 1123
public class DProb{
needs to be
public class dProb{
The most likely reason for this is your .java file is called dProb.java. The class name and file name must match!
Upvotes: 0
Reputation: 14177
While calling from you main function make sure the Class name is right.
As per your Error it seems Your Class name is having issue.
Your class name is DProb and you are typing dProb.
Also why are you returning 0.0 in HyperGeometric as you Probx variable is 0.0..
Upvotes: 1