I am just starting to use Java. I am using NetBeans and inside my .pkg1 file I have two .java files. I am doing the Coursera course on Algorithms by the way, so my code references that:
CourseraAlgorithmsWeek1.java
package coursera.algorithms.week.pkg1;
public class CourseraAlgorithmsWeek1 {
public static void main(String[] args) {
QuickFindUF mystuff(10); // DOES NOT WORK!
}
}
QuickFindUF.java
public class QuickFindUF {
private int[] id;
public QuickFindUF(int N){
id = new int[N];
for(int i =0; i< N; i++){
id[i] = i;
}
}
}
My problem is that the first line in my main function does not recognize the QuickFindUF object creation. I read that I need to compile the second file into a .class file, and then into a .jar file. How can I do this with netbeans?
I also read a bit about the Classpath. Can I only add .jar files to the classpath?