Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

can any one explain the output

 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I was working on the following code and got surprised with the output

public class Test {
int i=89;
ram k=new ram();
public void disp()
{
System.out.println("BABAwq111231`11121212213");
}
private class ram extends Test
{

public void disp()
{
System.out.println(i);
}
}


static public void main(String[] args)
{

new Test();

}






}

The output was

Exception in thread "main" java.lang.StackOverflowError

Please explain the cause ?? "i suspect the constructor invocation " but bit confussed........
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Please continue this discussion under the duplicate post, which already has responses. And please don't post duplicates.
 
The world's cheapest jedi mind trick: "Aw c'mon, why not read this tiny ad?"
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic