alice-teacher Alice 3 NetBeans Do-Together code issue
Carlos Bovell
cbovell at nburlington.com
Fri May 10 12:35:45 EDT 2024
Hi,
We ran into a problem where we tried typing the doTogether syntax directly in MyFirstMethod in NetBeans. We received an error saying that the doTogether nethod is not recognized:
C:\Users\cbovell\Documents\NetBeansProjects\PutFiveNumbersInOrder_starter_22\src\Scene.java:25: error: cannot find symbol
doTogether(() -> {
symbol: method doTogether(()->{ this[...]0); },()->{ this[...]0); },()->{ this[...]0); },()->{ this[...]0); })
location: class Scene
But when we drag over the control structure from the palette panel with the same exact syntax (honest!) it does work. Why would that be? What does dragging the doTogether over from the palette panel do that typing in the code does not do for NetBeans?
This is the code we typed:
{
doTogether(() -> {
this.dolphin.turn(TurnDirection.LEFT, 2.0);
}, () -> {
this.dolphin2.turn(TurnDirection.LEFT, 2.0);
}, () -> {
this.dolphin3.turn(TurnDirection.LEFT, 2.0);
}, () -> {
this.dolphin4.turn(TurnDirection.LEFT, 2.0);
});
}
This is the code from the dragged doTogether control structure:
doTogether(() -> {
//TODO: Code goes here
this.dolphin.turn(TurnDirection.LEFT, 2.0);
}, () -> {
//TODO: Code goes here
this.dolphin2.turn(TurnDirection.LEFT, 2.0);
}, () -> {
//TODO: Code goes here
this.dolphin3.turn(TurnDirection.LEFT, 2.0);
}, () -> {
//TODO: Code goes here
this.dolphin4.turn(TurnDirection.LEFT, 2.0);
});
Thank you for taking my questions.
Carlos Bovell
Northern Burlington High School
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20240510/eea71d42/attachment.html>
More information about the alice-teachers
mailing list