View Single Post
  #5 (permalink)  
Old 10-26-2007, 10:25 AM
hardwired hardwired is offline
Senior Member
 
Join Date: Jul 2007
Posts: 1,222
hardwired is on a distinguished road
I copied, pasted, altered the class names (to avoid name–clashing with previous class files) and compiled the code in your last post and got this in the console
Code:
C:\jexp>javac h3.java h3.java:62: cannot find symbol symbol : variable vals location: class H3 HistogramFreq2 freqCalc = new HistogramFreq2(vals); ^ h3.java:67: cannot find symbol symbol : method H3(int[]) location: class H3 f.getContentPane().add(H3(freqs)); ^ h3.java:68: cannot find symbol symbol : method getSize(int,int) location: class javax.swing.JFrame f.getSize(400, 400); ^ 3 errors
1 — You are collecting the user–entered values and saving them in an array named
Code:
int inputtedValue[] = new int[ 10 ];
so this would be the logical variable to pass into the HistogramFreq2 class constructor. Instead you have an undeclared variable "vals".
Code:
HistogramFreq2 freqCalc = new HistogramFreq2(vals); // should be HistogramFreq2 freqCalc = new HistogramFreq2(inputtedValue);
2 — You have omitted the new operator here
Code:
f.getContentPane().add(H3(freqs)); // should be f.getContentPane().add(new H3(freqs));
3 — Typo
Code:
f.getSize(400, 400); // should be f.setSize(400, 400);
Console errors generally give the line number of the difficulty in your source file and tell what is wrong.
Reply With Quote