LIVE NEWSROOM · --:-- · May 15, 2026
A LIBRARY FOR SECURITY RESEARCHERS

Java Programming Tutorial

Post on X LinkedIn
Java Programming Tutorial

Hello, guys welcome to my new article on introduction to Java programming language in which I will tell you what java programming is and how it works.

In this article, I will explain what java programming is, its operators, data types, and how to run java programs in Windows and Linux.

// 01 Java Programming

Java is a programming language used for developing and running applications. It was first released by Sun Microsystems in 1995 and is now a subsidiary of Oracle Corporation. It is an object-oriented language, which means that it is based on the concept of “objects”, which can contain data and code that manipulates that data. Java is known for being fast, reliable, and secure. It is also platform-independent. Platform-independent means Java programs can run on any device that has a Java Virtual Machine (JVM) installed.

Java code should be saved with the (.java) extension to be executed.

Syntax: –

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

// 02 Uses of Java Programming

Various uses of java programming are listed below: –

  1. Developing desktop applications
  2. Developing web applications
  3. Developing mobile applications
  4. Developing games
  5. Internet of Things (IoT) development
  6. Artificial Intelligence and Machine Learning
  7. Embedded systems development
  8. Developing smart cards and other secure devices
  9. Developing blockchain applications
  10. Developing chatbots and virtual assistants

// 03 Operators in Java Programming

In java programming language operators are divided into 3 categories which are Unary, Binary, and Ternary. There are a total of 10 types of operators present in java, which are given below: –

operators in java
  1. Arithmetic operator
  2. Relational operator
  3. Logical operator
  4. Boolean logical operator
  5. Increment/Decrement operator
  6. Bitwise operator
  7. Compound operator
  8. Assignment operator
  9. Instance operator
  10. Conditional operator

Arithmetic Operator

Arithmetic operators are used for performing mathematical operations like addition, subtraction, multiplication, and division. The basic arithmetic operators are +, -, *, and /. There is one more arithmetic operator which is % (modulus). It is a binary operator in which two operands are required to perform any operation.

Ex: –

public class Main {
  public static void main(String args[]) {
    int x = 2;
    int y = 4;
    int z = x + y;
    System.out.println(z);
  }
}

Relational Operator

A relational operator is used to compare two values and determine the relationship between them. The relational operators available in Java are <, >, <=, >=, ==, !=. Relational operators are binary operators in which two operands are required to perform any operation.

Ex: –

public class Main {
  public static void main(Strin args[]) {
    int x = 2;
    int y = 4;
    System.out.println(x > y); 
  }
}

Logical Operator

A logical operator is used to combine multiple relational expressions and create a more complex Boolean expression. The logical operators available in Java are &&(and), ||(or), !(not). It is a binary operator in which two operand is required to perform any operation.

Ex: –

public class Main {
  public static void main(String args[]) {
    int x = 5;
    int y = 10;
    int z = 15;

    if (x < y && y < z) {
      System.out.println("x is less than y and y is less than z");
    }
  }
}

Boolean logical Operator

The Boolean logical operators are used to perform logical operations on Boolean variables or expressions. The Boolean logical operators in Java are &, |, !, ^. It is a binary operator in which two operans are required to perform any operation.

Ex: –

public class Main {
  public static void main(String args[]) {
    boolean a = true;
    boolean b = false;

    if (a | b) {
    System.out.println("At least one of the expressions is true");
    }
  }
}

Increment/Decrement Operator

The increment and decrement operators are used to increase or decrease the value of a variable by a certain amount. The increment operator ++ and the decrement operator — can be used as prefixes or postfix operators. These are unary operators in which only one operand is required to perform any operation.

public class Main {
  public static void main(String args[]) {
    int a = 5;
	int b = ++a;
    System.out.println(b);
  }
}

Bitwise Operator

Bitwise operators are used for performing operations on the individual bits of an integer value. The bitwise operators in Java are & (and),| (or), ^ (xor), ~ (not), << (left shift), >> (right shift), and >>> (unsigned right shift). It is a binary operators.

Ex: –

public class Main {
  public static void main(String args[]) {
    int a = 5;   
    int b = 3;   
    int c = a ^ b;
    System.out.println(c);
  }
}

Compound Operator

Compound operators are used for combining an arithmetic or a bitwise operator with an assignment operator. It allows you to perform an operation and assign the result to a variable in a single step. It is a binary operator. The most common compound operators in Java are given below: –

  1. += (add and assign)
  2. -= (subtract and assign)
  3. *= (multiply and assign)
  4. /= (divide and assign)
  5. %= (modulus and assign)
  6. &= (bitwise and assign)
  7. |= (bitwise or and assign)
  8. ^= (bitwise xor and assign)
  9. <<= (left shift and assign)
  10. >>= (right shift and assign)
  11. >>>= (unsigned right shift and assign)

Ex: –

public class Main {
  public static void main(String args[]) {
    int a = 5;
    a += 2;
    System.out.println(a);
  }
}

Assignment Operator

The assignment operator = is used to assign a value to a variable. The value on the right side of the operator is stored in the variable on the left side of the operator. It is a unary operator.

Ex: –

public class Main {
  public static void main(String args[]) {
    int a = 10;
    int b = a;
    System.out.println(b);
  }
}

Instance Operator

An instance of an operator is used to determine whether an object is an instance of a particular class or interface. The instance of the operator returns a boolean value of true if the object is an instance of the specified class or interface, and false if it is not. It is a unary operator.

Ex: –

public class Main {
  public static void main(String args[]) {
    String str = "Hello";
    if (str instanceof String) {
      System.out.println("str is an instance of String");
    }
  }
}

Conditional Operator

The conditional operator is a shorthand way of writing an if-else statement. Conditional operators are (?) and (:). It is a ternary operator in which three operands are required for performing an operation. The syntax of the conditional operator is given below: –

expression1 ? expression2 : expression3

Ex: –

public class Main {
  public static void main(String args[]) {
    int a = 10;
    int b = 20;
    int c = (a > b) ? a : b;
    System.out.println(c);
  }
}

// 04 Data types in Java Programming

data types in java

Data types are the concept which is used to show or describe the nature of the variable whether it is an integer or character or another. In Java Data types are divided into four categories which are: –

  1. Integer
  2. Decimal
  3. Character
  4. Boolean

Data TypeSize in byteSize in bitsDescription
byte1 byte8 bitsStores whole numbers from -128 to 127 (Integer)
short2 bytes16 bitsStores whole numbers from -32,768 to 32,767 (Integer)
int4 bytes32 bitsStores whole numbers from -2,147,483,648 to 2,147,483,647
(Integer)
long8 bytes64 bitsStores whole numbers from -9,223,372,036,854,775,808 to
9,223,372,036,854,775,807 (Integer)
float4 bytes32 bitsStores fractional values up to 6 to 7 digits (Decimal)
double8 bytes64 bitsStores fractional values up to 15 digits (Decimal)
char0.125 byte1 bitStores a single letter/alphabet or ASCII value
boolean2 bytes16 bitsStores true or false values

    TE
    Team Ciphers Security

    Independent cybersecurity desk publishing daily threat intel and research since 2021. Practitioners writing for analysts, defenders, and learners. About us →

    Previous 10+ Basic PHP Programs Next 10+ Common Python Programs

    Latest News

    YARA-X 1.16.0: Faster Scans, Panic Fixes, and Neovim LSP Support YARA-X 1.16.0 ships with performance improvements across 10 PRs, constant folding for bitwise ops, configurable mat… Instructure Removed from ShinyHunters' Leak Site as Canvas Breach Deadline Passes Instructure was quietly removed from ShinyHunters' extortion site after the May 12, 2026 deadline — no data dump, n… Costa Rica Joins Have I Been Pwned as the 42nd Government Costa Rica's CSIRT gains free access to Have I Been Pwned's government domain monitoring service, becoming the 42nd… LummaC2 Infostealer Targets US Critical Infrastructure: CISA-FBI Advisory AA25-141B and DOJ Domain Seizures CISA and FBI advisory AA25-141B details LummaC2 MaaS infostealer TTPs targeting critical infrastructure. DOJ seized… MacSync Stealer: Hackers Abuse Google Ads and Claude.ai Chats to Push Mac Malware Russian-speaking attackers combine Google Ads and Claude.ai shared chats in a ClickFix campaign deploying MacSync S… JDownloader Site Hacked, Installers Swapped with Python RAT Malware JDownloader's website was hacked May 6–7, 2026, replacing Windows and Linux installers with a Python-based RAT. Use… Operation HookedWing: 4-Year Phishing Campaign Hits 500+ Organizations Across Aviation, Energy, and Logistics Operation HookedWing has stolen credentials from 500+ organizations in aviation, energy, logistics, and critical in… Twelve Critical vm2 Node.js Vulnerabilities Enable Sandbox Escape and Arbitrary Code Execution A dozen CVEs in the vm2 Node.js sandbox library — including CVSS 10.0 flaws — allow sandbox escape and RCE. Update …
    Scroll to Top