Search:

Type: Posts; User: Norm

Search: Search took 0.09 seconds.

  1. Replies
    42
    Views
    2,192

    Re: Prime number problem (please help)

    Glad you got it working.
  2. Replies
    42
    Views
    2,192

    Re: Prime number problem (please help)

    Did you try changing the source and compiling it? What did the compiler say?
  3. Replies
    42
    Views
    2,192

    Re: Prime number problem (please help)

    Put the keyword static first thing on the line.
  4. Replies
    42
    Views
    2,192

    Re: Prime number problem (please help)

    ??? I just said the name of the variable that should be made static: out

    See the tutorial about static: http://docs.oracle.com/javase/tutorial/java/nutsandbolts/variables.html
  5. Replies
    42
    Views
    2,192

    Re: Prime number problem (please help)

    Make out a static variable.
  6. Replies
    42
    Views
    2,192

    Re: Prime number problem (please help)

    Is this the one?

    Change printf() to print()
    Or read the API doc for the printf() method to see how to use it.

    If you have questions about the API doc, copy the doc here and ask your questions...
  7. Replies
    42
    Views
    2,192

    Re: Prime number problem (please help)

    Too much code in static methods is causing that error.
    Did you Google that error. It is very common.

    For now make out a static variable.
  8. Replies
    42
    Views
    2,192

    Re: Prime number problem (please help)

    It has a problem and needs to be changed. That is what all the posts since then have been about. You were supposed to change the code.

    Move the definition for the variable: out outside of the...
  9. Replies
    42
    Views
    2,192

    Re: Prime number problem (please help)

    Please post the whole class where that statement is.

    The error message says that statement is in the wrong place in the code.

    Do you know how to define a variable?
  10. Replies
    42
    Views
    2,192

    Re: Prime number problem (please help)

    You need to copy the full text of the error message and paste it here. I can't see your code from here.
  11. Replies
    42
    Views
    2,192

    Re: Prime number problem (please help)

    Please read post#19
    Where is out defined?


    class A_Class {
    int classVar; // define at class level; in Scope for all methods

    void meth1() {
    int aVar; // define aVar; in...
  12. Replies
    42
    Views
    2,192

    Re: Prime number problem (please help)

    If it is defined inside of a method, then it is OUT OF SCOPE in any other method. Move its definition out of the method to the class level so all methods can see it.
    A variable can be defined in...
  13. Replies
    42
    Views
    2,192

    Re: Prime number problem (please help)

    Where is the variable: out defined? Is it in scope where the error happens?
  14. Replies
    42
    Views
    2,192

    Re: Prime number problem (please help)

    That's a compiler error which means your code is not ready for execution. You need to find out what symbol is not found. Try using the javac command to compile the file. It gives nice error...
  15. Replies
    42
    Views
    2,192

    Re: Prime number problem (please help)

    What symbol is not found?
  16. Replies
    42
    Views
    2,192

    Re: Prime number problem (please help)

    Try it and see what happens. Print the contents of the array using:
    System.out.println("an ID "+ java.util.Arrays.toString(theArrayNameHere));
    Recommend doing it for 25 elements vs 2500 for...
  17. Replies
    42
    Views
    2,192

    Re: Populate an array?

    Use a for loop containing an assignment statement.
Results 1 to 17 of 17