0% found this document useful (0 votes)
7 views17 pages

Unit 4 Presentation 1

The document provides an introduction to Java, detailing its history, features, and structure. Java, developed by Sun Microsystems in 1995, is a high-level, object-oriented programming language known for its platform independence and robustness. It covers key concepts such as Java keywords, operators, data types, and inheritance, along with examples of Java program structure and compilation processes.

Uploaded by

teetram08
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views17 pages

Unit 4 Presentation 1

The document provides an introduction to Java, detailing its history, features, and structure. Java, developed by Sun Microsystems in 1995, is a high-level, object-oriented programming language known for its platform independence and robustness. It covers key concepts such as Java keywords, operators, data types, and inheritance, along with examples of Java program structure and compilation processes.

Uploaded by

teetram08
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 17

INTRODUCTION TO JAVA

(UNIT-4)

Mr. Ravi Kant Mishra


Asst. Professor
Department of Computer Application
WHAT IS JAVA?
 Java is a programming language and a platform. Java
is a high-level, robust, object-oriented and secure
programming language.
 Java was developed by Sun Microsystems (which is now

a subsidiary of Oracle) in the year 1995.


 James Gosling is known as the father of Java. Before

Java, its name was Oak. Since Oak was already a


registered company, so James Gosling and his team
changed the name from Oak to Java.
 Platform: Any hardware or software environment in

which a program runs is known as a platform. Since Java


has a runtime environment (JRE) and API, it is called a
platform.
JAVA HISTORY
 1991: "Oak" project started by James Gosling at Sun
Microsystems
 1995: Java 1.0 released, "Write Once, Run Anywhere"

(WORA)
 Key Milestones:
 1998: Java 2 (J2SE, J2EE, J2ME)
 2004: Java 5 (Generics, Enums)
 2014: Java 8 (Lambda expressions, Streams)
 2017+: Six-month release cycle (Java 9, 11, 17 LTS)
 Current: Java 21 (LTS) as of April 2025
 Impact: Widely used in web, mobile, and enterprise

applications.
JAVA FEATURES
 Platform Independence: Bytecode runs on any JVM
 Object-Oriented: Encapsulation, inheritance,

polymorphism
 Simple: No pointers, automatic memory management

 Robust: Exception handling, type checking

 Secure: Sandboxing, no direct memory access

 Multithreaded: Built-in support for concurrent

programming
 High Performance: JIT compiler optimizes bytecode

 Dynamic: Supports runtime changes via reflection


STRUCTURE OF A JAVA PROGRAM
class Simple{
public static void main(String args[])
{ System.out.println("Hello Java"); }
}
 class keyword is used to declare a class in Java.

 public keyword is an access modifier that represents visibility. It

means it is visible to all.


 static is a keyword. If we declare any method as static, it is

known as the static method. The core advantage of the static


method is that there is no need to create an object to invoke the
static method. The main() method is executed by the JVM, so it
does not require creating an object to invoke the main() method.
So, it saves memory.
 void is the return type of the method. It means it does not
return any value.
 The main() method represents the starting point of the

program.
 String[] args or String args[] is used for

command line argument. We will discuss it in coming section.


 System.out.println() is used to print statement on the console.

Here, System is a class, out is an object of the PrintStream


class, println() is a method of the PrintStream class. We will
discuss the internal working of System.out.println() statement
in the coming section.
COMPILING AND INTERPRETING
APPLICATIONS
 Compilation:
 javac MyProgram.java → Converts source code to bytecode
(.class file)
 Performed by Java Compiler (javac)
 Interpretation:
 java MyProgram → JVM interprets bytecode to machine
code
 JVM (Java Virtual Machine) ensures platform independence
 Process:
 WriteJava code (.java)
 Compile to bytecode (.class)
 Run on JVM
JAVA KEYWORDS

 In Java, keywords are the reserved words that have

some predefined meanings and are used by the Java

compiler for some internal process or represent some

predefined actions. These words cannot be used as

identifiers such as variable names, method names, class

names, or object names.


OPERATORS AND EXPRESSIONS
 Operators:
 Arithmetic: +, -, *, /, %
 Relational: ==, !=, >, <, >=, <=
 Logical: &&, ||, !
 Bitwise: &, |, ^, ~, <<, >>
 Assignment: =, +=, -=, etc.
 Ternary: condition ? value1 : value2

 Expressions:
 Combination of operands and operators
 Evaluates to a single value
IDENTIFIERS

 User-defined names for variables, methods, classes


 Rules:
 Must start with a letter, _, or $
 Can include letters, digits, _, $
 Cannot be a keyword
 Case-sensitive
DATA TYPE
Type Size Range of Values
boolean 8 bits true, false
byte 8 bits -128 to 127
Characters Representation of
char 16 bits ASCII values
0 to 255
short 16 bits -32,768 to 32,767
-2,147,483,648
int 32 bits to
2,147,483,647

-9,223,372,036,854,775,808
long 64 bits to
9,223,372,036,854,775,807

float 32 bits up to 7 decimal digits


double 64 bits up to 16 decimal digits
IMPLEMENTATION OF
INHERITANCE
 Definition: Mechanism where a class
(subclass) inherits properties and methods
from another class (superclass).
 Purpose: Promote code reuse, establish a

hierarchical relationship.
 Types:
 Single,Multilevel, Hierarchical (Java does not
support multiple inheritance directly).
 Example:

class Animal {
void eat() { System.out.println("Eating..."); }
}
class Dog extends Animal {
void bark()
{ System.out.println("Barking..."); }
}
THANK YOU

You might also like