Java Revision

Java Revision

ยท

2 min read


What is java ?

Java is a high-level, object-oriented programming language originally developed by Sun Microsystems and released in 1995. It is designed to be platform-independent, meaning that Java programs can run on any device that has a Java Virtual Machine (JVM) installed, regardless of the underlying hardware and operating system.


  • JVM (Java Virtual Machine): Executes Java bytecode on different platforms.

  • JRE (Java Runtime Environment): Includes the JVM and libraries for running Java applications.

  • JDK (Java Development Kit): Full toolkit for Java development, including JRE, compiler, and tools.


hello world Program


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

Variables In Java

Variable is just a container which stores data.

Primitive Data Types

  1. Integer

    1. byte

    2. short

    3. int

    4. long

  2. Float

    1. float

    2. double

  3. Characters

  4. Boolean

Size of the data types

Data TypeSize (in bits)Highest Value
byte8127
short1632,767
int322,147,483,647
long649,223,372,036,854,775,807
float32Approximately 3.4E38
double64Approximately 1.7E308
char865,535 (represents ' ' in Unicode)
boolean-true or false
ย