Introduction

Java is a very popular strongly-typed programming language used by developers worldwide. To declare a variable's type, you simply mention it before the variable name as follows:

String myString;

There are also primitive types in Java, making operations involving them more efficient by optimizing the necessary storage bits or bytes. These declarations are example of primitive types, which always start with a lowercase letter:

int myNumber;
double myDecimalNumber;
char myCharacter;

Oracle Corp. (headquartered in Redwood Ciy, CA, United States of America) is the current owner of Java. Oracle releases new updates to Java called JDK's on a yearly-or-so basis.

What you should already know

Java has been around since before the turn of the century.

With hundreds of thousands of developers worldwide, Java is one of the more popular backend development languages today.

JavaScript and Java

JavaScript and Java are similar in some ways but fundamentally different in some others. The JavaScript language resembles Java but does not have Java's static typing and strong type checking.

In contrast to Java's compile-time system of classes built by declarations, JavaScript supports a runtime system based on a small number of data types representing numeric, Boolean, and string values.

Hello World

To get started with writing Java, open your favorite Java IDE (for example Eclipse, Spring Tool Suite, JDeveloper, etc) and write your first "Hello world" Java code:

class Main { public static void main(String args[]) { System.out.println("Hello World!"); } }

Run the class from the IDE tools and watch your first piece of Java magic unfold!

Data types

The latest Java Development Kit has many data types, including the following:

  • Some data types that are primitives start with lowercase:

    • boolean. true and false.
    • null. A special keyword denoting a null value.
    • int. 42 or -5
    • float. 3.14159 or other decimals

  • and descendants of Object that start with an uppercase letter, these are not primitive types. For example, String. "Howdy"
Although these data types are a relatively small amount, they enable you to perform useful functions with your applications. Objects and functions are the other fundamental elements in the language. You can think of objects as named containers for values, and functions as procedures that your application can perform.

Reference