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...
Type: Posts; User: r0x
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...
ok thank you all for replies but is any solution to my question ?
how user2 can access file1 and modify it concurrently with user1 ?
import java.io.File;
import java.util.Calendar;
@SuppressWarnings("serial")
public class TxtFile extends File implements Cloneable
{
//Name of File
private String fileName;
//Code
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...
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...
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...
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())
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...
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...
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...
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...
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...
Thank you very much for explications!! This forum is cool \m/
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 ?
// 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...
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 ?
public class Point {
private double x;
private double y;
public Point(double x, double y) {
this.x = x;
this.y = y;
}
I got it ) thank you
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...
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} };
}
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...