I am trying to make a class in Java that builds an object of type Action which holds three ints and returns it to my other class in the array history, where history is an
array of type Action. When it is called I immediately get an endless loop; hence the stack overflow.
Error - I printed 1 line, it goes on...
Exception in thread "main" java.lang.StackOverflowError
at sudokugame.Action.<init>(Action.java:7)
Class:
public class Action {
Action a;
public Action(int i, int o, int p){
a = new Action(i,o,p);
}
public void setAction(int n, int b, int c){
}
public Action getAction(){
return a;
}
}