Java Stack flow Exception error | Selenium Forum
M
Posted on 08/09/2015
Question : when I run below code I got the Java Stack flow error.

I want to know when I created test object and accessing in main fun why its giving this error.

I can create static and non static object ref of a class.

Please clarify.

Thanks



public class T14 {

T14 test = new T14();
int i;
static int j;
static T14 test1 = new T14();

public static void main(String[] args) {
//T14 test = new T14();
test.i =10;
//test1.i = 11;
//j = 22;
//test1.i = 999;
test1.j = 444;
System.out.println( "i " + test.i );

System.out.println( "j " + test1.j );


}

}

M
Replied on 08/09/2015

test is non static
You cannot access it in static function
Please watch video 3:
http://qtpselenium.com/selenium-training/selenium-tutorial/selenium-training-java-part-3