Search:

Type: Posts; User: r0x

Search: Search took 0.19 seconds.

  1. Replies
    9
    Views
    729

    Re: can't use the file declared in other thread

    ok, I have the method modify in Wiki class


    public synchronized void modify(String fileName, String newContent) throws Exception
    {
    if(!repository.containsKey(fileName))
    throw new...
  2. Replies
    9
    Views
    729

    Re: can't use the file declared in other thread

    ok thank you all for replies but is any solution to my question ?
    how user2 can access file1 and modify it concurrently with user1 ?
  3. Replies
    9
    Views
    729

    Re: can't use the file declared in other thread

    import java.io.File;
    import java.util.Calendar;

    @SuppressWarnings("serial")
    public class TxtFile extends File implements Cloneable
    {

    //Name of File
    private String fileName;
    //Code
  4. Replies
    9
    Views
    729

    Re: can't use the file declared in other thread

    ok, I can declare file variables even before user1 thread and it will be accessible by user2 BUT it would mean that user1 didn't create any files, and I want that user1 creates file1 & file2 inside...
  5. Replies
    9
    Views
    729

    can't use the file declared in other thread

    Hello, I'm stuck a little bit with the following code. What I want is that user2 is able to modify as well the file1, so that was the point of the exercise to show efficient concurrent access to the...
  6. Thread: can't add a file

    by r0x
    Replies
    2
    Views
    336

    can't add a file

    import java.io.BufferedInputStream;
    import java.io.BufferedReader;
    import java.io.BufferedWriter;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileWriter;
    import...
  7. Replies
    2
    Views
    556

    Re: can't compare class fields

    thanks for the reply!! the problem was also in accessing elements of the ArrayList, I forgot that there is a method get() :)


    if (dp.getSeqNo() == dataPackets.get(j).getSeqNo())
  8. Replies
    2
    Views
    556

    can't compare class fields

    hi ! There two classes
    Node.java
    DataPacket.java
    The problem is I can't compare the field of the passed object "dp" with the field of the stored dataPacket, data packets are stored in the...
  9. Replies
    0
    Views
    749

    Apache XML-RPC server creation problem

    Hi ! I would like to ask what's going wrong in my code. How can I avoid the error: "The method addHandler(String, MyServer) is undefined for the type WebServer". Finally I need to have a working...
  10. Replies
    2
    Views
    1,579

    can't create the instance of the second class

    Hi again! Can't get why the Eclipse underlines the line below
    msg error: No enclosing instance of type HelloRunnable is accessible. Must qualify the allocation with an enclosing instance of type...
  11. Thread: Create a polygone

    by r0x
    Replies
    20
    Views
    1,939

    Re: Create a polygone

    big thanks for answers!!! so the polygone was created let's say in my way but there is still teacher's method (because he wanted to start off with the 2D array of endpoints), for now I don't...
  12. Thread: Create a polygone

    by r0x
    Replies
    20
    Views
    1,939

    Re: Create a polygone

    Have another question, I put the code straight away to be more clear

    ArrayList<Point><Line> points = new ArrayList<Point><Line>();

    Is it possible to put in the same ArrayList objects of...
  13. Thread: Create a polygone

    by r0x
    Replies
    20
    Views
    1,939

    Re: Create a polygone

    Thank you very much for explications!! This forum is cool \m/
  14. Thread: Create a polygone

    by r0x
    Replies
    20
    Views
    1,939

    Re: Create a polygone

    so the idea is that when I use System.out.println() this method needs toString to print the stuff ? and by default println takes Object's toString, am I right ?
  15. Thread: Create a polygone

    by r0x
    Replies
    20
    Views
    1,939

    Re: Create a polygone

    // Custom toString() Method.
    public String toString() {
    return "X=" + x + " " + "Y=" + y;
    }

    ok, so I need to write my own version of toString method ? so that after in Main it could be...
  16. Thread: Create a polygone

    by r0x
    Replies
    20
    Views
    1,939

    Re: Create a polygone

    the problem is that I have no idea what toString is, I heard about this but never understood :-/
    can u just write how can I see the contents of points ?
  17. Thread: Create a polygone

    by r0x
    Replies
    20
    Views
    1,939

    Re: Create a polygone

    public class Point {

    private double x;
    private double y;

    public Point(double x, double y) {
    this.x = x;
    this.y = y;
    }
  18. Thread: Create a polygone

    by r0x
    Replies
    20
    Views
    1,939

    Re: Create a polygone

    I got it ) thank you
  19. Thread: Create a polygone

    by r0x
    Replies
    20
    Views
    1,939

    Re: Create a polygone

    ok thanks but I changed to double
    so I was thinking may be an ArrayList would be a good choice so here is the code


    public class Point {

    private double x;
    private double y;

    public...
  20. Thread: Create a polygone

    by r0x
    Replies
    20
    Views
    1,939

    Re: Create a polygone

    ok


    public class PolygoneMain {
    public static void main(String[] args) {

    float[][2] endpoints = { {2.7,5.4}, {1.1,2.8}, {1.9,1.3} };

    }
  21. Thread: Create a polygone

    by r0x
    Replies
    20
    Views
    1,939

    Create a polygone

    Hi all! My name is Dan and I'm first time here. Hope someone can help me with the task.
    The exercice is from my exam and it sounds like this:

    a) Define proper data structures to represent a...
Results 1 to 21 of 21