• Skip to main content
  • Skip to primary sidebar

Founder at work

Master the skills to create and launch your next SaaS company

  • About Me
  • Reviews
  • Resources
  • Community
  • Contact
  • Lessons
  • Series
  • Search
  • Login

How to use primitive data types in easy steps

August 22, 2012 by Rick Hernandez Leave a Comment

How to convert primitive data types upward?

This a list of order primitives from biggest to smallest

  • double x64 bits
  • float
  • long
  • int
  • short
  • byte

So how do you convert primitive data types upward you must first understand the data types and how they are related to each other in this example you see the data types from biggest to smallest ^ .  Now lets break this down to an example. In the following code i declare a value of “intValue” set to 100 and then passing that value to a new variable data typed as a double and giving it a name of “doubleStats” and setting it to intValue so the results is 100 (integer) gets (double) to 120.0 with the decimal of .0 making more precise although the integer value is truncated they fundamentally still have the same value, this type of converting is called implicit and reliable upward numeric conversion.

 


int intValue = 120;
double doubleStat = intValue;

Rick Hernandez

I always had a passion for the field of STEM (Science, Technology, Engineering, and Math) and I knew I wanted to do something to make a difference in the world. I just didn’t know where to start. I was an immigrant in a new country, grew up in a tough environment, and wasn’t sure how… Read More

Share this:

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)

Related

Filed Under: Java, Mathematics, Programming

Primary Sidebar

Learn How To Take Your Idea And Convert It Into An App From Scratch Even If You Have Never Written A Single Line Of Code.

  • How to Find Your Next Great App Idea
  • The Secret To Getting PAID To Build Your Own App
  • How To Create Your App (SaaS, Mobile, VR, AR, Game)
  • How To Monetize Your Apps
Learn More
4.82 Ratings

Copyright © 2023 · JSecademy Blog Theme on Genesis Framework · WordPress · Log in