Skip to content

What is Java?

Java-bean, java-rice, java-what??? Java-the-hutt?

  • Everything is an object: Built entirely on an object model, bundling data and operations together into modular objects.
  • Supports OOP Principles: Natively supports Inheritance, Encapsulation, Polymorphism, and Classes.
  • Extensible: Because it is entirely object-based, the language itself can be easily scaled and extended.

We will learn more about this in the next chapters!

  • Bytecode over Machine Code: Code compiles into a universal, platform-neutral format called bytecode rather than machine-specific instructions.
  • “Write Once, Run Anywhere” (WORA): The Java Virtual Machine (JVM) reads and runs this bytecode on any underlying platform.

Tech Tip: Think of bytecode as a universal language, like English, that everyone can understand, while the JVM acts as a translator for each computer. You write your Java program once, and the JVM translates it into instructions that work on Windows, macOS, Linux, or any other platform without changing the code.

  • Processor Agnostic: Bytecode runs seamlessly on any CPU architecture.
  • No OS-specific Tweaks: The Java Runtime Environment (JRE) automatically handles execution across different hardware, meaning a program written on Windows runs on macOS without a single code change.

Tech Tip: Building on the earlier information, imagine your Java program is on an outdated adapter (like micro-usb). The JRE is like basically like a universal adapter that lets it plug into different computers. No matter what processor or operating system the computer uses, the JRE makes sure the same program works without needing any changes or setup! (Does your device still use a micro-usb? smh)

  • No Direct Memory Access: Architecture prevents developers from directly tampering with the computer’s memory or operating system.
  • Sandbox Protection: Restricts web-based Java programs from unauthorized reading or writing to your local hard drive.
  • Automatic Garbage Collection: Automatically reclaims unused memory, preventing memory leaks without manual developer intervention.

Don’t worry, you’ll learn more about memory, sandbox protection, and garbage collection in the CSARCH/LBYARCH series and CSADPRG! For now, just think of Java as a secure language where you won’t have to deal with memory allocation (like in C)!

  • Early Defenses: Enforces strict type checking and heavy compile-time error checks to catch bugs before execution.
  • Safety Nets: Built-in runtime exception handling safeguards the program from crashing the entire system when an error occurs.
  • Network-Ready: Native architecture designed specifically for internet and network environments.
  • Extensive Libraries: Packed with massive, pre-written code libraries that simplify building enterprise and web-based applications.

Tech Tip: TLDR: Java has tons of support. Think of a feature and there’s probably a java library or framework out there for it.

  • Concurrent Execution: Inbuilt support for running multiple parts of a program simultaneously (multiprocessing).
  • Native Management: Built-in tools smoothly handle complex thread behaviors like monitors, deadlocks, and race conditions.

Don’t worry, you’ll learn more about threading and multithreading in CSOPESY and CSNETWK! For now, just think of java as having the ability to execute multiple parts of a program all at once!

  • JIT Compiler: Though it is an interpreted language, the Just-In-Time (JIT) compiler optimizes and accelerates bytecode execution on the fly to maximize speed.

Recall: In simple terms, an interpreted language is a language that works by having an interpreter program read the code in real time and executes it.

  • Familiar Syntax: Inherits its structure from C and C++, making it incredibly easy for developers with that background to pick up.
  • Beginner-Friendly: Highly structured and accessible, even for those learning programming completely from scratch.

(Erm, this is just what the books says…You tell me)

Tip: If you get an answer wrong, expand your understanding by consulting the internet on why!

Card 1 / 7
Question

True or False: Since Java is purely object-oriented, primitive data types like int and boolean are inherently structured as full objects from the moment they are declared.

Click or press Enter to flip
Answer

False. Java is not 100% pure because it retains primitive types for performance; however, it is built entirely on an object model and natively bundles data and operations into modular objects.

Click or press Enter to flip back