been baning my head against the wall in what is probably, a simple problem that I just don't quite understand. I have these three classes, tring to pass object/methods between them.
Heres the first class
public class LargeMapDriver
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
int value1;
ThyPoint p1 = new ThyPoint(132, 734);
ThyPoint p2 = new ThyPoint(56, 998);
ThyPoint p3 = new ThyPoint(100, 105);
System.out.println("Enter value: ");
order = keyboard.nextInt();
LargeMap myMap = new LargeMap(value1, p1, p2, p3);
Secondly, the pointer class.
public class ThyPoint
{
private int a;
private int b;
//constructor
public ThyPoint(int x, int y)
{
a = x;
b = y;
}
//...
//set and get methods for a and b... not shown
//...
public String toString()
{
return "a: " + getValueA() + " b: " + getValueA();
}
}
The final class, the one shows a constructor error.
public class LargeMap
{
//GETTING CONSTRUCTOR(s) ERROR
public static void goodMethod(int value1, ThyPoint p1, ThyPoint p2, ThyPoint p3)
{
if ( value1 == 0 )
System.out.println( p1.toString() + p2.toString() + p3.toString());
else
System.out.println( p2.toString() + p3.toString() + p1.toString());
}
}
Ok, so the problem occurs:
**constructor LargeMap in class LargeMap cannot be applied to given types;
LargeMap myMap = new LargeMap(value1, p1, p2, p3);
^
required: no arguments
found int,ThyPoint,ThyPoint,ThyPoint
reason: actual and formal arguments differ in length**
So, I'm trying to create a constructor for the LargeMap class, but failing, I'm trying to pass those values in the p1, p2, p3 objects into the constructor to accept. And to initialize the values in them, how do I do this? The values I want to initialize in them are:
ThyPoint p1 = new ThyPoint(132, 734);
ThyPoint p2 = new ThyPoint(56, 998);
ThyPoint p3 = new ThyPoint(100, 105);
Also the class LargeMap must remain void. It doesn't have to be static or public though.