Subject:
|
Re: What is exception "StackOverflowError" in method "<clinit>"
|
Newsgroups:
|
lugnet.robotics.rcx.java
|
Date:
|
Wed, 22 May 2002 19:49:25 GMT
|
Viewed:
|
3965 times
|
| |
| |
In lugnet.robotics.rcx.java, Roger Glassey writes:
> In lugnet.robotics.rcx.java, Juergen Stuber writes:
> > I suppose TextLCD.print should work, though I never used it,
> > so probably it is really a stack overflow.
> > Is the call deeply nested?
> >
> > Jürgen
> I have tried TextLCD.print() and it really does work.
> Roger
Yes, you are both right (Thanks anyway)
1. TextLCD.print() works perfectly when called from simple programs
2. My code is most probably using too deep calls (Why is this not covered in
the 10/10 'Core' book of Bagnall)
BUT, QUESTION FOR YOU ALL:
From the following sample code,
how can you explain that the failing instruction
TextLCD.print(title) in menuChoice2()
suddently works if you call another method of the same class before ?
Is there some caching or inline code triggered in some way ?
While you debug my code (hey, LEGO is a game no ?), I am searching why
another big program starts one of my motors very very slowly without me
asking for it, I guess I am now facing a memory corruption or something like
that.
/*
Compile with
>emu-lejos -o BumpyRadarEMU.bin BumpyRadar
Run in emulator with
>emu-lejosrun -v BumpyRadarEMU.bin
*/
import josx.platform.rcx.*;
import josx.robotics.*;
class BumpyRadar {
public static void main(String args[]) {
new BumpyRadar().init();
}
public void init() {
getMenuValues();
}
public void getMenuValues() {
// Calling menuChoice2 works
// Menu.menuChoice2("X");
// Calling menuChoice2 does not work bcos much depth in calls
// But, amazingly enough,
// it works if you first call menuChoice2() !!!!
Menu.menuChoice1();
}
}
class Menu {
public static void menuChoice1() {
menuChoice2("Y");
}
public static void menuChoice2(String title) {
LCD.showNumber(1);
TextLCD.print(title);
LCD.showNumber(2);
}
}
|
|
Message has 1 Reply:
Message is in Reply To:
5 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|