Sec-88
  • 🧑Whoami
  • 🕸️Web-AppSec
    • Features Abuse
      • 2FA
      • Ban Feature
      • CAPTCHA
      • Commenting
      • Contact us
      • File-Upload
      • Inviting Feature
      • Messaging Features
      • Money-Related Features
      • Newsletter
      • Profile - Settings
      • Registration
      • Reset Password
      • Review
      • Rich Editor/Text
      • Social Sharing
      • Billing-Shipping Address Management
      • Integrations - Webhooks
      • API Key Management
    • Reconnaissance
      • Attacking Organizations with big scopes
    • Subdomain Enumeration
    • Fingerprinting
    • Dorking
    • XSS-HTML Injection
    • Improper Authentication
      • JWT Security
    • OAUTH Misconfigurations
      • OAuth 2.0 Basics
      • OAUTH Misconfigurations
    • Auth0 Misconfigurations
    • Broken Access Control
      • Insecure Direct Object References (IDOR)
      • 403 Bypass
    • Broken Link Injection
    • Command Injection
    • CORS
    • CRLF
    • CSRF
    • Host Header Attacks
    • HTTP request smuggling
    • JSON Request Testing
    • LFI
      • LFI to RCE
    • No Rate Limit
    • Parameters Manual Testing
    • Open Redirect
    • Registration & Takeover Bugs
    • Remote Code Execution (RCE)
    • Session Fixation
    • SQL Injection
      • SQL To RCE
    • SSRF
    • SSTI
    • Subdomain Takeover
    • Web Caching Vulnerabilities
    • WebSockets
    • XXE
      • XXE to RCE
    • Cookie Based Attacks
    • CMS
      • AEM [Adobe CMS]
    • XSSI (Cross Site Script Inclusion)
    • NoSQL injection
    • Local VS Remote Session Fixation
    • Protection
      • Security Mechanisms for Websites
      • Cookie Flags
      • SameSite Cookie Restrictions
      • Same-origin policy (SOP)
      • CSP
    • Hacking IIS Applications
    • Dependency Confusion
    • Attacking Secondary Context
    • Hacking Web Sockets
    • IDN Homograph Attack
    • DNS Rebinding Attack
    • LLM Hacking Checklist
    • Bypass URL Filtration
    • Cross-Site Path Traversal (CSPT)
    • PostMessage Security
    • Prototype Pollution
      • Client-Side Prototype Pollution
      • Server-Side prototype pollution
    • Tools-Extensions-Bookmarks
    • WAF Bypassing Techniques
    • SSL/TLS Certificate Lifecycle
    • Serialization in .NET
    • Client-Side Attacks
      • JavaScript Analysis
    • Bug Bounty Platforms/Programs
  • ✉️API-Sec
    • GraphQL API Security Testing
      • The Basics
      • GraphQL Communication
      • Setting Up a Vulnerable GraphQL Server
      • GraphQL Hacking Tools
      • GraphQL Attack Surface
      • RECONNAISSANCE
      • GraphQL DOS
      • Information Disclosure
      • AUTHENTICATION AND AUTHORIZATION BYPASSES
      • Injection Vulnerabilities in GraphQL
      • REQUEST FORGERY AND HIJACKING
      • VULNERABILITIES, REPORTS AND EXPLOITS
      • GraphQL Hacking Checklist
    • API Recon
    • API Token Attacks
    • Broken Object Level Authorization (BOLA)
    • Broken Authentication
    • Evasive Maneuvers
    • Improper Assets Management
    • Mass Assignment Attacks
    • SSRF
    • Injection Vulnerabilities
    • Excessive Data Exposure
    • OWASP API TOP 10 MindMap
    • Scanning APIs with OWASP ZAP
  • 📱Android-AppSec
    • Setup Android App Pentesting environment on Arch
    • Setup Android App Pentesting environment on Mac M4
    • Setup Android Pentesting Environment on Debian Linux
    • Android App Fundamentals
      • Android Architecture
      • Android Security Model
      • Android App Components
        • Intents
        • Pending Intents
    • Android App Components Security Cheatsheet
    • Android App Pentesting Checklist
    • How To Get APK file for application
    • ADB Commands
    • APK structure
    • Android Permissions
    • Exported Activity Hacking
    • BroadcastReceiver Hacking
    • Content Provider Hacking
    • Signing the APK
    • Reverse Engineering APK
    • Deep Links Hacking
    • Drozer Cheat Sheet
    • SMALI
      • SMALI Cheat Sheet
      • Smali Code Patching Guide
    • Intent Redirection Vulnerability
    • Janus Vulnerability (CVE-2017-13156)
    • Task Hijacking
    • Hacking Labs
      • Injured Android
      • Hacking the VulnWebView Lab
      • Hacking InsecureBankv2 App
    • Frida Cheat Sheet
  • 📶Network-Sec
    • Networking Fundamentals
    • Open Ports Security Testing
    • Vulnerability Scanning
    • Client Side Attacks
    • Port Redirection and Tunneling
    • Password Attacks
    • Privilege Escalation [PrevEsc]
      • Linux Privilege Escalation
    • Buffer Overflow (BOF)
      • VulnServer
      • Sync Breez Enterprize
      • Crashed CTF
      • BOF for Linux
    • AV Evasion
    • Post Exploitation
      • File Transfer
      • Maintaining Access
      • Pivoting
      • Clean Up
    • Active Directory
      • Basic AD Pentesting
  • 💻Desktop AppSec
    • Thin Client vs. Thick Client
  • ☁️Cloud Sec
    • Salesforce Hacking
      • Basics
      • Salesforce SAAS Apps Hacking
    • Firebase
    • S3 Buckets Misconfigurations
  • 👨‍💻Programming
    • HTML
    • JavaScript (JS)
      • window.location object
    • Python
      • Python Tips
      • Set
        • SetMethods
    • JAVA
      • Java Essentials
      • Java Essentials Code Notes
      • Java OOP1
      • JAVA OOP Principles
        • Inheritance
        • Method Overriding
        • Abstract Class
        • Interface
        • polymorphism
        • Encapsulation
        • Composition
      • Java OOP Challenges
      • Exception Handling
    • Go
      • Go Syntax Tutorial in one file
      • Methods and Interfaces
      • Go Slices
      • Go Maps
      • Go Functions
      • Concurrency
      • Read Files
      • Write Files
      • Package
        • How to make personal Package
        • regexp Packages
        • Json
        • bufio
        • Time
      • Signals-Exit
      • Unit Testing
  • 🖥️Operating Systems
    • Linux
      • Linux Commands
      • Tools
      • Linux File System
      • Bash Scripting guide
      • tmux
      • Git
      • Install Go tools from private repositories using GitHub PAT
    • VPS
    • Burp Suite
  • ✍️Write-Ups
    • Hunting Methodology
    • API BAC leads to PII Data Disclosure
    • Misconfigured OATUH leads to Pre-Account Takeover
    • Automating Bug Bounty with GitHub Actions
    • From Recon to Reward: My Bug Bounty Methodology when Hunting on Public Bug Bounty Programs
    • Exploring Subdomains: From Enumeration to Takeover Victory
    • 0-Click Account Takeover via Insecure Password Reset Feature
    • How a Simple Click Can Lead to Account Takeover: An OAuth Insecure Implementation Vulnerability
    • The Power Of IDOR even if it is unpredictable IDs
    • Unlocking the Weak Spot: Exploiting Insecure Password Reset Tokens
    • AI Under Siege: Discovering and Exploiting Vulnerabilities
    • Inside the Classroom: How We Hacked Our Way Past Authorization on a Leading EdTech Platform
    • How We Secured Our Client’s Platform Against Interaction-Free Account Thefts
    • Unchecked Privileges: The Hidden Risk of Role Escalation in Collaborative Platforms
    • Decoding Server Behavior: The Key to Mass Account Takeover
    • Exploiting JSON-Based CSRF: The Hidden Threat in Profile Management
    • How We Turned a Medium XSS into a High Bounty by Bypassing HttpOnly Cookie
Powered by GitBook
On this page
  • Java JDK, JRE and JVM
  • What is JDK?
  • Relationship between JVM, JRE, and JDK.
  • Java Operators
  • Arithmetic Operator
  • Logical Operators
  • Java Unary Operators
  • Java Assignment Operators
  • Java Relational Operators
  • Java Logical Operators
  • Java Bitwise Operators
  • Java Basic Input and Output
  • Java Output
  • Java Input
  • Java Flow Control
  • Java if...else Statement
  • Java switch Statement
  • Java for Loop
  • for-each Loop Sytnax
  • Java while loop
  • Break Statement
  • How break statement works?
  • Java break and Nested Loop
  • Labeled break Statement
  • Java continue Statement
  • Java continue with Nested Loop
  • Labeled continue Statement
  • Java Arrays

Was this helpful?

Edit on GitHub
  1. 👨‍💻Programming
  2. JAVA

Java Essentials

PreviousJAVANextJava Essentials Code Notes

Last updated 1 year ago

Was this helpful?

Java JDK, JRE and JVM

  • JVM (Java Virtual Machine) is an abstract machine that enables your computer to run a Java program.

  • JRE (Java Runtime Environment) is a software package that provides Java class libraries, Java Virtual Machine (JVM), and other components that are required to run Java applications.

  • JDK (Java Development Kit) is a software development kit required to develop applications in Java. When you download JDK, JRE is also downloaded with it.

What is JDK?

JDK (Java Development Kit) is a software development kit required to develop applications in Java. When you download JDK, JRE is also downloaded with it.

In addition to JRE, JDK also contains a number of development tools (compilers, JavaDoc, Java Debugger, etc).

If you want to develop Java applications, download JDK.


Relationship between JVM, JRE, and JDK.

Java Operators

Operators in Java can be classified into 5 types:

  1. Arithmetic Operators

  2. Assignment Operators

  3. Relational Operators

  4. Logical Operators

  5. Unary Operators

  6. Bitwise Operators

Arithmetic Operator

Operator
Operation

+

Addition

-

Subtraction

*

Multiplication

/

Division

%

Modulo Operation (Remainder after division)

Logical Operators

Operator
Description

~

Bitwise Complement

<<

Left Shift

>>

Right Shift

>>>

Unsigned Right Shift

&

Bitwise AND

^

Bitwise exclusive OR

Java Unary Operators

Operator
Meaning

+

Unary plus: not necessary to use since numbers are positive without using it

-

Unary minus: inverts the sign of an expression

++

Increment operator: increments value by 1

--

Decrement operator: decrements value by 1

!

Logical complement operator: inverts the value of a boolean

Java Assignment Operators

Operator
Example
Equivalent to

=

a = b;

a = b;

+=

a += b;

a = a + b;

-=

a -= b;

a = a - b;

*=

a *= b;

a = a * b;

/=

a /= b;

a = a / b;

%=

a %= b;

a = a % b;

Java Relational Operators

Operator
Example
Equivalent to

=

a = b;

a = b;

+=

a += b;

a = a + b;

-=

a -= b;

a = a - b;

*=

a *= b;

a = a * b;

/=

a /= b;

a = a / b;

%=

a %= b;

a = a % b;

Java Logical Operators

Operator
Example
Meaning

&& (Logical AND)

expression1 && expression2

true only if both expression1 and expression2 are true

|| (Logical OR)

expression1 || expression2

true if either expression1 or expression2 is true

! (Logical NOT)

!expression

true if expression is false and vice versa

Java Bitwise Operators

Operator
Description

~

Bitwise Complement

<<

Left Shift

>>

Right Shift

>>>

Unsigned Right Shift

&

Bitwise AND

^

Bitwise exclusive OR

Java Basic Input and Output

Java Output

System.out.println(); or
System.out.print(); or
System.out.printf();

Java Input

import java.util.Scanner;
// create an object of Scanner
Scanner input = new Scanner(System.in);
// take input from the user
int number = input.nextInt();

Java Flow Control

Java if...else Statement

Working of if Statement


How the if...else statement works?


How the if...else...if ladder works?


class Main {
  public static void main(String[] args) {

    int number = 0;

    // checks if number is greater than 0
    if (number > 0) {
      System.out.println("The number is positive.");
    }

    // checks if number is less than 0
    else if (number < 0) {
      System.out.println("The number is negative.");
    }
    
    // if both condition is false
    else {
      System.out.println("The number is 0.");
    }
  }
}

Output

The number is 0.

Java switch Statement

switch (expression) {

  case value1:
    // code
    break;
  
  case value2:
    // code
    break;
  
  ...
  ...
  
  default:
    // default statements
  }

Java for Loop


for-each Loop Sytnax

// print array elements 
class Main {
  public static void main(String[] args) {
    // create an array
    int[] numbers = {3, 9, 5, -5};
    // for each loop 
    for (int number: numbers) {
      System.out.println(number);
    }
  }
}

/* Output
3
9
5
-5
*/

Java while loop

while (testExpression) {
    // body of loop
}

do {
    // body of loop
} while(textExpression);

Break Statement

How break statement works?

if (number < 0.0) {
    break;
}

Java break and Nested Loop

Labeled break Statement

Java continue Statement

Working of Java continue statement

Java continue with Nested Loop.


Java continue with Nested Loop

Labeled continue Statement

Java Arrays

String[] array = new String[100];
// declare arrray 
dataType[] arrayName;
// declare an array
int[] age = new int[5];

// initialize array
age[0] = 12;
age[1] = 4;
age[2] = 5;
..
int[][] a = new int[3][4];

Here, we have created a multidimensional array named a. It is a 2-dimensional array, that can hold a maximum of 12 elements,

Java Development Kit
Relationship between JVM, JRE, and JDK
Working of Java if statement
Working of Java if-else statements
Working of if...else...if ladder
Flowchart of Java for loop
Flowchart of Java while loop
Flowchart of Java do while loop
Working of Java break Statement
Working of break Statement with Nested Loops
Working of the labeled break statement in Java
Working of Java continue Statement
Java Arrays initialization
2-dimensional Array
if the number is greater than 0, code inside if block is executed, otherwise code inside if block is skipped
JDK contains JRE and other tools to develop Java applications.
JRE contains JVM and class libraries and JDK contains JRE, compilers, debuggers, and JavaDoc
If the first test condition if true, code inside first if block is executed, if the second condition is true, block inside second if is executed, and if all conditions are false, the else block is executed
Working of for loop in Java with flowchart
If the condition is true, the code inside the if block is executed, otherwise, code inside the else block is executed
The labeled break statement is used to break the outermost loop.
Flowchart of do...while loop in Java
The working of continue statement with Java while, do...while, and for loop.
How break statement works in Java programming?
Flowchart of while loop in Java
The break statement terminates the innermost while loop in case of nested loops.
2-dimensional array in Java
Elements are stored in the array