Hallo
folgender Teil meines Quellcodes will nicht compilieren:
Das new wiill irgendwie nicht mitverarbeitet werden... wenn ichs weglasse klappts aber auch net
Die Fehler meldung lautet:
Das '^' steht genau unter dem 'n' von 'new'
Zur Erläuterung hier die Vertex2D.java
Ich hoffe mir kann jmd helfen... weiss echt net was da falsch is!!
folgender Teil meines Quellcodes will nicht compilieren:
Code:
public void drawLine (Vertex2D vertexA, Vertex2D vertexB) {
Vertex2D start;
Vertex2D end;
//Verification of input
if ( vertexA.getX() < vertexB.getX() ) {
start = new Vertex2D (vertexA);
end = new Vertex2D (vertexB);
} else if ( vertexA.getX() > vertexB.getX() ) {
start = new Vertex2D (vertexA);
end = new Vertex2D (vertexB);
} else {
System.out.println("we cannot draw vertical lines...");
return;
}
Das new wiill irgendwie nicht mitverarbeitet werden... wenn ichs weglasse klappts aber auch net
Die Fehler meldung lautet:
C:\Dokumente und Einstellungen\Thomas\Eigene Dateien\RWTH Aachen\Informatik\Übungen\Übungsblatt 5\GraphicsContext.java:128: cannot find symbol
symbol : constructor Vertex2D(Vertex2D)
location: class Vertex2D
start = new Vertex2D (vertexA);
^
Das '^' steht genau unter dem 'n' von 'new'
Zur Erläuterung hier die Vertex2D.java
Code:
/**
* This class represents a discrete two-dimensional coordinate, which
* can be used to define geometrical objects.
*
* @author Jakob T. Valvoda
* @version 14.07.06
*/
public class Vertex2D {
private int x = 0;
private int y = 0;
/**
* Initializes the object by setting its x and y value.
*
* @param newX the coordinate in x direction.
* @param newY the coordinate in y direction.
*/
public void init( int newX, int newY ) {
x = newX;
y = newY;
}
/**
* Sets a new x coordinate.
*
* @param newX the new x coordinate.
*/
public void setX( int newX ) {
x = newX;
}
/**
* Returns the x coordinate of this vertex.
*
* @return the x coordinate of this vertex.
*/
public int getX() {
return x;
}
/**
* Sets a new y coordinate.
*
* @param newY the new y coordinate.
*/
public void setY( int newY ) {
y = newY;
}
/**
* Returns the y coordinate of this vertex.
*
* @return the y coordinate of this vertex.
*/
public int getY() {
return y;
}
/**
* Returns a textual representation of the {@link Vertex2D} objects value.
*
* @return a textual representation of this vertex.
*/
public String toString() {
return "Vertex: ( " + x + ", " + y + " )";
}
}
Ich hoffe mir kann jmd helfen... weiss echt net was da falsch is!!