Search:

Type: Posts; User: bassie

Search: Search took 0.12 seconds.

  1. Thread: synchronization

    by bassie
    Replies
    2
    Views
    219

    synchronization

    hi could someone please help me understand how interference might occur in this program ?



    class ThreadTest implements Runnable {
    static String printString = null;
    private String threadName;...
  2. Thread: MAUDE

    by bassie
    Replies
    6
    Views
    244

    [SOLVED] Re: MAUDE

    Ye that's what I thought, and I can't remember where I read it now but it said somewhere that the add operation itself should be implemented as a Node constructor, with the add functions in it but I...
  3. Thread: MAUDE

    by bassie
    Replies
    6
    Views
    244

    [SOLVED] Re: MAUDE

    Thanks Norm, found out that for this particular problem add is defined as a constructor in the Node class.
  4. Thread: MAUDE

    by bassie
    Replies
    6
    Views
    244

    [SOLVED] MAUDE

    So I've been asked to implement a linked list in java using the following maude specification:


    Below is a Maude specification of ‘Sorted Lists’: lists of integers in increasing order.



    ...
  5. Replies
    5
    Views
    374

    Re: error: missing return statement

    But why would the code ignore 3 out of 4 of the get() tests? it returns the "name" integer when called the second time, but not the "string" integer or the two notfounds!

    also, if I swap the...
  6. Replies
    5
    Views
    374

    Re: error: missing return statement

    Hello again Norm, and thanks for the response.

    I thought that might be the case, but as far as I can tell this method can return nothing but an int.

    if the list is empty (head == null), it...
  7. Replies
    5
    Views
    374

    error: missing return statement

    I am getting this error and I'm not quite sure why...

    java:69: error: missing return statement
    }
    ^

    That's the entire error, and here is the code:
  8. Replies
    14
    Views
    397

    Re: Thread synchronisation help!

    ah there is nothing missing I made a mistake there. I am finding this way too difficult to grasp so I am going to focus on using synchronisation with monitors instead. Thanks for the help!
  9. Replies
    14
    Views
    397

    Re: Thread synchronisation help!

    So I edited run() to help me try and trace what the program is doing at each step;



    public void run()
    {
    System.out.println("Begin of run("+num+")");
    for (int k=0; k<2000000; k++)...
  10. Replies
    14
    Views
    397

    Re: Thread synchronisation help!

    Thanks for the advice norm, but this actually looks hopeless. The numbers are printed out in random order regardless of how they are ordered in the main method or what priority I set them, if I am...
  11. Replies
    14
    Views
    397

    Re: Thread synchronisation help!

    so it turns out I was looking at it wrong, the code is slightly different (this book is really confusing), but the revised version still doesn't work.
    The textbook claims it will print out...
  12. Replies
    14
    Views
    397

    Re: Thread synchronisation help!

    Do you mean the currentThread method? I don't understand how I am meant to be using it...

    Should I some how be referencing the run () method from NumberPrinter.java in the main() method of...
  13. Replies
    14
    Views
    397

    Re: Thread synchronisation help!

    Thanks!

    I looked it up and it appears that the setPriority method is defined in the Thread class.
    I tried calling it using Thread.sePriority() but got an error for trying to call a non-static...
  14. Replies
    14
    Views
    397

    Re: Thread synchronisation help!

    Well the book seems so be suggesting that setPriority() is part of the interface Runnable, or at least that I can use it in this situation by simply calling it. Am I misunderstanding this entirely?
  15. Replies
    14
    Views
    397

    Thread synchronisation help!

    Hi whenever I try to run Numbers.java I get;

    NumberPrinter.java:8: error: cannot find symbol
    setPriority(n);
    ^
    ...
  16. Replies
    4
    Views
    498

    Re: variable might not have been initialized!!

    Thanks for the reply again Norm!

    I assume that by this you mean that when I define variable name I should set it as something, i.e.




    public final String name = x;
  17. Replies
    4
    Views
    498

    variable might not have been initialized!!

    I keep getting this error message with this code and I don't understand what it's telling me! Do I need to sort of merge the two chatter methods?




    .\Chatter.java:96: error: variable name...
  18. Re: **Constructor in class cannot be applied to given types;...

    Hi curmudgeon thanks for your response!

    The problem of the class not being able to be applied to given types seems to have been resolved now, but I am still getting the following:

    error:...
  19. Replies
    2
    Views
    317

    [SOLVED] Re: Abstract method in a non-abstract class

    thanks helloworld, I just created an empty method and got rid of all the abstracts and now that problem appears to be solved
  20. **Constructor in class cannot be applied to given types;...

    I kind of understand why I am getting this error but have no idea how to solve it.

    I think the constructor 'Chatter' requires a String, and the method add does not supply that. I tried adding...
  21. Replies
    2
    Views
    317

    [SOLVED] Abstract method in a non-abstract class

    Is there any way of achieving this, or some way of achieving the same result in another way?

    I basically have an abstract method in a class, which is of course also abstract. I have another...
  22. Thread: Java pointers

    by bassie
    Replies
    5
    Views
    410

    Re: Java pointers

    Well in the example code provided by the lecturer it appears that next is just used as a command to give the next element in a list, as he never actually defines what 'next' should do anywhere else...
  23. Thread: Java pointers

    by bassie
    Replies
    5
    Views
    410

    Re: Java pointers

    Hi Norm, thanks for the reply!
    I believe the list is a linked list, but I have no idea how to actually tell the program to point towards an actual element in the list... This is what I've done so...
  24. Thread: Java pointers

    by bassie
    Replies
    5
    Views
    410

    Java pointers

    Hi I am currently in my second year studying computer science and the assignment I have been assigned to complete is one in which I am required to create a chat room server. I have been really bad at...
Results 1 to 24 of 24