Sep 23, 2015

Go Language For Java Developer Part-4


Following keywords are reserved and may not be used as identifiers.

Java Language Keywords

abstract continue for new switch
assert default goto package synchronized
boolean do if private this
break double implements protected throw
byte else import public throws
case enum instanceof return transient
catch extends int short try
char final interface static void
class finally long strictfp volatile
const float native super while

Go Language Keywords

break default func interface select
case defer go map struct
chan else goto package switch
const fallthrough if range type
continue for import return var

There are few obvious keywords like break, case, if, for, etc but few keywords are new in Go Language.
  1. func: To declare function
  2. interface: To declare interface (It's different than Java's interface)
  3. defer: something like finalise method in Java
  4. go: To create thread
  5. chan: To do synchronised between threads
  6. var: To declare variable
  7. range: It's like iterator in Java