hi
error comes due to wrong declaration of the constructor Point();
because there is no return type of Constructor but here he declares like this
void point(int a,int b)
{
this.x=a;
this.y=b;
}
it should be declare like this ,
point(int a,int b)
{
this.x=a;
this.y=b;
}
----- Original Message -----
From: prasad jedhe
To: [email protected]
Sent: Monday, February 02, 2009 2:30 PM
Subject: [java programming] need help
>> i have written this code & am getting an error at line 5 as "cannot find
symbol ;symbol :constructor point(int,int )"
public class Main //line 1
{ //line 2
public static void main(String[] args) //line 3
{ //line 4
point p1 = new point(5,6); //line 5<< giving error at this
line
p1.print();
}
}
class point
{
private int x=0;
private int y=0;
void point(int a,int b)
{
this.x=a;
this.y=b;
}
void print()
{
System.out.println("Value of x: "+x+ " Value of y:"+y);
System.out.println("-------------------------------");
}
}
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---