INTRODUCTION TO JAVA

Cards (32)

  • ORIGIN OF JAVA (Conceived Java at Sun Microsystems (1991))


    • James Gosling
    • Patrick Naughton
    • Chris Warth
    • Ed Frank
    • Mike Sheridan
  • ORIGIN OF JAVA
    called “Oak” but was renamed “Java” in 1995.
  • ORIGIN OF JAVA(1)
    object-oriented programming language developed by James Gosling.
  • ORIGIN OF JAVA(2)
    Java is intended to be compiled into a bytecode, which a Java Virtual Machine then runs.
  • 1991
    James Gosling, Mike Sheridan, and Patrick Naughton started a project to create the Java language.
  • ORIGIN OF JAVA
    OakGreenJava (type of coffee from Indonesia).
  • ORIGIN OF JAVA
    Gosling used syntax similar to C/C++.
  • ORIGIN OF JAVA
    1996Sun Microsystems released Java 1.0.
  • ORIGIN OF JAVA
    Web browsers started supporting Java, making it popular.
  • Java 2 came out with different versions for various platforms:
    J2EE – servers → Java EE
    J2ME – mobiles → Java ME
    J2SE – desktops → Java SE
  • FEATURES OF JAVA
    • Platform-Independent
    • Object-oriented Language
    • Fast
    • Secure
    • Rich Standard Library
  • Platform-Independent
    programs in Java can run on any device or platform that has a Java Virtual Machine installed.
    “Write Once, Run Anywhere” (WORA) principle
  • Object-oriented Language
    supports concepts such as encapsulation, inheritance, and polymorphism, which makes it easier to design
  • Fast
    relatively fast language due to its use of a Just-In-Time (JIT) compiler.
  • Secure
    provides a robust security model.
  • Rich Standard Library
    comprehensive Standard Library (Java API) provides a wide range of pre-built classes and packages.
  • JAVA
    • (Platform Independence) Platform - independent
    • (Memory Management) Automatic memory management (garbage collection)
    • (Object-Oriented) More strictly
    • (Security) Built-in security features
  • C++
    • (Platform Independence) Need to be compiled separately
    • (Memory Management) Manual memory management
  • JDK (Java Development Kit)

    comprehensive software development kit that includes tools and resources needed to develop, compile, and run Java applications.
  • JDK (Java Development Kit) COMPONENTS:
    Compiler (javac)
    Java Virtual Machine (JVM)
    Java Runtime Environment (JRE)
    Development Tools
  • Compiler (javac) 

    Translates Java source code into bytecode.
  • Java Virtual Machine (JVM) 

    Executes Java bytecode.
  • Java Runtime Environment (JRE) 

    Provides libraries, Java class libraries, and other files necessary for running Java applications.
  • Development Tools
    Debuggers, profilers, and other utilities.
  • JAVA CODE
    Java ProgramJava Compiler → Java Byte Code → Java InterpreterMachine Code
  • SAMPLE JAVA CODE
    public class Hello {
    public static void main(String[] args) {
    System.out.println("Hello World");
    }
    }
  • JAVA OUTPUT
    In Java, to send output to standard output we can simply use
    System.out.println(); or System.out.print();
  • print()

    It prints string inside the quotes.
  • println() 

    It prints string inside the quotes similar like print() method. Then the cursor moves to the beginning of the next line.
  • JAVA COMMENT
    can be used to explain Java code, and to make it more readable.
  • Single Line Comment
    start with two forward slashes (//).
  • Multi-line comments
    start with /* and end with */.