illegal start of expression

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Jan 2008
Posts: 55
Reputation: sfar_furqan is an unknown quantity at this point 
Solved Threads: 1
sfar_furqan's Avatar
sfar_furqan sfar_furqan is offline Offline
Junior Poster in Training

illegal start of expression

 
0
  #1
Feb 5th, 2009
[code]
  1. public class LineSeg{
  2.  
  3. // these are the attributes of a LineSeg object
  4. private Point end1;
  5. private Point end2;
  6. private double length;
  7.  
  8. // the constructor
  9. public LineSeg(double x1, double y1, double x2, double y2) {
  10.  
  11. end1 = new Point(x1,y1);
  12. end2 = new Point(x2,y2);
  13. this.length=(double)(Math.sqrt((x2-x1)**2+(y2-y1)**2));
  14. }
  15. }
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 55
Reputation: sfar_furqan is an unknown quantity at this point 
Solved Threads: 1
sfar_furqan's Avatar
sfar_furqan sfar_furqan is offline Offline
Junior Poster in Training

Re: illegal start of expression

 
0
  #2
Feb 5th, 2009
cant think of anything to make it work continuously giving the same error
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 69
Reputation: h3xc0de is an unknown quantity at this point 
Solved Threads: 12
h3xc0de h3xc0de is offline Offline
Junior Poster in Training

Re: illegal start of expression

 
0
  #3
Feb 5th, 2009
You have to many * in this.length=(double)(Math.sqrt((x2-x1)**2+(y2-y1)**2));
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 2,052
Reputation: Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice 
Solved Threads: 139
Team Colleague
Rashakil Fol's Avatar
Rashakil Fol Rashakil Fol is offline Offline
Super Senior Demiposter

Re: illegal start of expression

 
1
  #4
Feb 5th, 2009
There's no "**" operator in Java. Either use Math.pow or write your own squaring function.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 55
Reputation: sfar_furqan is an unknown quantity at this point 
Solved Threads: 1
sfar_furqan's Avatar
sfar_furqan sfar_furqan is offline Offline
Junior Poster in Training

Re: illegal start of expression

 
0
  #5
Feb 7th, 2009
thanks
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC