Search:

Type: Posts; User: Norm

Page 1 of 3 1 2 3

Search: Search took 0.10 seconds.

  1. Re: Changing the attribute of an instance object of a class that's declared in another package and whose variable is constructed by its parent class

    Make a small complete program that shows the problem.
    This is my last post unless the requested testing code is posted that shows the problem.
  2. Re: Changing the attribute of an instance object of a class that's declared in another package and whose variable is constructed by its parent class

    It is very hard to follow your posts.
    Can you write a smaller complete testing program with some classes, methods and variables that demonstrates the problem you are having?
    This is getting to...
  3. Re: Changing the attribute of an instance object of a class that's declared in another package and whose variable is constructed by its parent class

    The variables need to be defined and in scope at the statement where you try to access them.

    I made a suggestion earlier about writing a test program with some classes for testing this problem....
  4. Re: Changing the attribute of an instance object of a class that's declared in another package and whose variable is constructed by its parent class

    Why static ? That would be OK for a method that does not need to access any instance variables in the class.
  5. Re: Changing the attribute of an instance object of a class that's declared in another package and whose variable is constructed by its parent class

    See my last post.
  6. Re: Changing the attribute of an instance object of a class that's declared in another package and whose variable is constructed by its parent class

    Those terms are for a user viewing the game being played.
    Try explaining the problem in programming terms using variable names and their contents, etc.
  7. Re: Changing the attribute of an instance object of a class that's declared in another package and whose variable is constructed by its parent class

    What does that mean? What is a block? What does "stops"mean for a block?

    What is the method: legalDown() supposed to do?

    I still see this mix of x(a column) with a variable named row:...
  8. Re: Changing the attribute of an instance object of a class that's declared in another package and whose variable is constructed by its parent class

    Why do you think there should be non-0s in the array? Where are there non-0 values assigned to elements of the array?
  9. Re: Changing the attribute of an instance object of a class that's declared in another package and whose variable is constructed by its parent class

    Sorry, I have no ideas on what methods you need or what should be in them.
  10. Re: Changing the attribute of an instance object of a class that's declared in another package and whose variable is constructed by its parent class

    I use println statements.
  11. Re: Changing the attribute of an instance object of a class that's declared in another package and whose variable is constructed by its parent class

    Time for more debugging to see what the code is doing.



    synchronized void moveLeft() {

    currentX--;
    That code says that x is a column. Not a row: board[x+row]
  12. Re: Changing the attribute of an instance object of a class that's declared in another package and whose variable is constructed by its parent class

    Look at line 49 and see why the index is past the end of the array.



    The code still is using the confusing x,y and row,col variables.
  13. Re: Changing the attribute of an instance object of a class that's declared in another package and whose variable is constructed by its parent class

    With good, consistent names for the variables, some of the confusion will be removed and the code can be easier to understand. Mixing x,y with row,col is confusing and should be removed.
  14. Re: Changing the attribute of an instance object of a class that's declared in another package and whose variable is constructed by its parent class

    The posted code still has the confusion between using x,y and row,col. It would be less confusing if the code worked with a single style of names.
    To me x is a column value and y is a row value. ...
  15. Re: Changing the attribute of an instance object of a class that's declared in another package and whose variable is constructed by its parent class

    Continue debugging the code until you see what is happening.
  16. Re: Changing the attribute of an instance object of a class that's declared in another package and whose variable is constructed by its parent class

    I use println statements to display the values of variables at each step of the process to see what the computer sees. If you understand what values the variables should have as the code executes,...
  17. Re: Changing the attribute of an instance object of a class that's declared in another package and whose variable is constructed by its parent class

    Hard coding magic numbers like 28 and 32 makes for hard to maintain and understand code. Try using variables.
  18. Re: Changing the attribute of an instance object of a class that's declared in another package and whose variable is constructed by its parent class

    At line 75 the index to an array went past the end of the array.
    Remember that array indexes range in value from 0 to the array length-1

    Use the println method to print out the values of the...
  19. Re: Changing the attribute of an instance object of a class that's declared in another package and whose variable is constructed by its parent class

    Note the difference in the data types. The compiler wants them to match exactly.

    reason: actual argument double cannot be converted to int by method invocation conversion

    Is currentY double vs...
  20. Re: Changing the attribute of an instance object of a class that's declared in another package and whose variable is constructed by its parent class

    Try using the javac program to compile the code. The error messages you are posting are not complete.
    Here is a sample of a javac error message:


    TestSorts.java:138: cannot find symbol
    symbol ...
  21. Re: Changing the attribute of an instance object of a class that's declared in another package and whose variable is constructed by its parent class

    That is true of most of a program. Not much happens when the code is compiled.

    Try writing the small exercise program to get an idea of where code should go.
  22. Re: Changing the attribute of an instance object of a class that's declared in another package and whose variable is constructed by its parent class

    Again this problem is a basic OOP programming problem. You're trying to work with code that is past your knowledge. I suggest that you take a break from this project and go back and study the...
  23. Re: Changing the attribute of an instance object of a class that's declared in another package and whose variable is constructed by its parent class

    Again, this is basic OOP programming. Calling a method define in a class from another class is a very basic technique that is used over and over and over in programs.

    There should only be one...
  24. Re: Changing the attribute of an instance object of a class that's declared in another package and whose variable is constructed by its parent class

    You need to add a getter method to the Grid class that returns a reference to contents.


    That's done. Board and Piece extend Grid.
    Again this is basic OOP that you need to know before working...
  25. Re: Changing the attribute of an instance object of a class that's declared in another package and whose variable is constructed by its parent class

    Time to go back to the design for the program and see what needs to be done to what data by what methods at what time in the execution.
Results 1 to 25 of 73
Page 1 of 3 1 2 3