DZone
Java Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Java Zone > Go Language for Java Developers Part 3

Go Language for Java Developers Part 3

Part 3 of a 5 part series that explains the Go language to Java developers.

Ketan Parmar user avatar by
Ketan Parmar
·
Apr. 23, 16 · Java Zone · Tutorial
Like (4)
Save
Tweet
8.37K Views

Join the DZone community and get the full member experience.

Join For Free
In Java, we have primitive data types and objects. Java support 8 primitive data types: 
Data TypeValue
byte0
short0
int0
long0L
float0.0f
double0.0d
char'\u0000'
booleanfalse
Reference: https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html 

The Go language is a statically typed programming language. This means that variable always has specific type that can't be changed. The Go language data type can be divided in main three categories:

  1. Boolean: A boolean type represents the set of Boolean truth values denoted by the predeclared constants true and false. The predeclared boolean type is bool.
  2. Numeric: A numeric type represents sets of integer or floating-point values. The predeclared architecture-independent numeric types are: int, float32, float64, etc
  3. String: A string type represents the set of string values. A string value is a (possibly empty) sequence of bytes. Strings are immutable: once created, it is impossible to change the contents of a string. The predeclared string type is string.
Data TypeDefault ValueRange
boolfalsetrue or false
int0either int32 or int64
int80signed 16-bit integers (-32768 to 32767)
int160signed 16-bit integers (-32768 to 32767)
int320signed 32-bit integers (-2147483648 to 2147483647)
int640signed 64-bit integers (-9223372036854775808 to 9223372036854775807)
uint0either 32 or 64 bits
uint80unsigned 8-bit integers (0 to 255)
uint160unsigned 16-bit integers (0 to 65535)
uint320unsigned 32-bit integers (0 to 4294967295)
uint640unsigned 64-bit integers (0 to 18446744073709551615)
float320IEEE-754 32-bit floating-point numbers
float640IEEE-754 64-bit floating-point numbers
string


 Reference: https://golang.org/ref/spec#Types 

 Next article we will learn about variables in the Go Language

More Reading

  • Part 1

  • Part 2

  • Part 3

  • Part 4

  • Part 5

Data Types Java (programming language) Strings 32-bit 64-bit

Published at DZone with permission of Ketan Parmar, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Making Machine Learning More Accessible for Application Developers
  • Application Scalability — How To Do Efficient Scaling
  • Migrating Secrets Using HashiCorp Vault and Safe CLI
  • Debugging Deadlocks and Race Conditions

Comments

Java Partner Resources

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo