Posts

Java Basics

Java is an object-oriented language. Compile once and runs everywhere, JVM is the masterpiece which makes it possible to run java compiled classes on every platform. Let's discuss java primitive types: Java has 8 primitive types byte, boolean, short, int, long, float, double and char. What are primitive types and why java needs it? Every language has primitive types, I mean computer languages. And these primitive types are the basic types which any language used for holding its variable values.  for example, if you want to write a table of 2. So, the computer machine has to save that value (numeric 2) somewhere in memory and do the required calculation using that value (numeric 2) and print the table.  In order to save that numeric value 2, java has decided to provide a datatype called int for its users. And the same goes for boolean because you may need to save the true or false value.  I hope you now understand why we need float and ...