Overview of Java Programming Language

Nov 24, 2024

Java Overview

Introduction to Java

  • High-level multi-paradigm programming language
  • Designed by James Gosling in 1990 at Sun Microsystems
  • Gained popularity due to platform-independent bytecode

History

  • First demonstration: Star 7 PDA
  • Java mascot: Duke
  • Currently one of the world's most popular programming languages

Applications

  • Powers enterprise web apps with Spring Framework
  • Used in big data pipelines with Hadoop
  • Development of mobile apps on Android
  • Controls NASA's Maestro Mars rover

Key Features

  • Compiles to bytecode instead of machine code (unlike C/C++)
  • Runs on any operating system via Java Virtual Machine (JVM)
  • Compiled and interpreted language
  • Requires Java Runtime Environment (JRE) for execution
  • "Write once, run anywhere" capability

Language Characteristics

  • Strongly typed language
  • Curly brace syntax similar to C family
  • High-level features include:
    • Garbage collection
    • Runtime type checking
    • Reflection

Getting Started with Java

  1. Install Java Development Kit (JDK)
  2. Create a file with a .java extension
    • File name should match the class name
    • Class must contain a main method (entry point of the program)

Basic Syntax

  • Define a variable:
    • Start with a type, followed by a name and value
  • Print to standard output using the built-in System class

Classes and Methods

  • Define functions as methods within a class:
    • public: accessible outside the class
    • static: member of the class, not an instance
  • Provide a return type, name, and return value
  • Create custom classes (blueprints for objects)
    • Add attributes and methods
    • Use the new keyword to instantiate objects

Object-Oriented and Functional Support

  • Java is object-oriented but supports functional programming patterns (e.g., lambda expressions)

Compiling and Running Java Programs

  • Use the compiler to generate a .class file (contains bytecode)
  • Run the bytecode with the java command via JVM

Conclusion

  • Successfully built an enterprise-grade application
  • Call to action: Subscribe for more content and potential full Java tutorial if 100,000 likes are reached