We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Trying to run the below code in Processing produces the above result. However, the exact same coding compiles and run perfectly in Eclipse. Can anyone explain why please?
The result should be "a-b c-d".
Martin
public class Shuffle1 {
public static void main(String[] args) {
int x = 3;
while (x > 0)
{
if (x > 2) {
System.out.print("a");
}
x = x - 1;
System.out.print("-");
if (x == 2){
System.out.print("b c");
}
if (x == 1){
System.out.print("d");
x = x - 1;
}
}
}
}
Answers
http://forum.Processing.org/two/discussion/8045/how-to-format-code-and-text
Processing's IDE (PDE) has a pre-processor which already concatenates all ".pde" files as 1 ".java" class.
And that includes the
public static void main(String[] args) {}
stuff already! :(|)Take notice that all our classes become locally nested to the "invisible" sketch's top class too! ~:>
This will do the same thing in Processing
Thank you very much. That makes sense. However, when I run the code I get a small grey window with no text in it. Have I set the application up wrong?
Martin
no
processing is designed to display graphical output in that window. you're just not using it so it appears the default size and colour.
Thanks again for the information. Although not new to Java, you've probably guessed I'm new to Processing. As my Son is using this at his University I thought it would be good idea to learn to use it so I can help him out if needed.