Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Go: A question about "methods on types"

 
atul khot
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Mark,

Here goes ;-) a code snippet from gotour,



What is happening on line 18?

The syntax
-math.Sqrt2
is this the same as
-math.Sqrt(2)

The lack of parenthesis stumped me...
I understand the rest...

--- thanks atul
 
atul khot
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess math.Sqrt2 is some constant in the math package...

--- cheerio atul
 
Mark Summerfield
author
Ranch Hand
Posts: 37
Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Atul,

Yes you're right math.Sqrt2 is a predefined constant.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic