0% found this document useful (0 votes)
16 views

Java Programming Unit I-Lecture - 002

Uploaded by

ctamilkannan4
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Java Programming Unit I-Lecture - 002

Uploaded by

ctamilkannan4
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

19CACN1204 – Java Programming

Unit- 1 : Java Fundamentals and Classes

Topic : Overview of Java

Faculty : Dr. R. MUTHUSAMI, Associate Professor/MCA


Course Outcomes
CO1: Apply the operators, control structures, classes and
objects in the given problem
CO2: Apply the exception handling and multithreading in
given problem
CO3: Apply the collection classes and interfaces in given
applications.
CO4: Apply the string and string buffer classes in the given
problem.
CO5: Develop an application using AWT controls

C Programming 2
UNIT I-Java Fundamentals and Classes
Java Fundamentals: Introduction – Overview of Java virtual
machine- Data types, variable, arrays, expressions, operators,
and control structures. Classes and Objects: Classes – Objects –
Abstract classes- Static classes- Inner classes- Method
Overloading- Inheritance, Constructors and Method Overriding.

C Programming 3
Outline

• Characteristics of Java

• Versions

• Editions

• Anatomy

C Programming 4
Java, Web, and Beyond
• Java can be used to develop Web
applications.
• Java Applets
• Java Servlets and JavaServer Pages
• Java can also be used to develop
applications for hand-held devices such as
Palm and cell phones
Characteristics of Java
• Java Is Simple
• Java Is Object-Oriented
• Java Is Distributed
• Java Is Interpreted
• Java Is Robust
• Java Is Secure
• Java Is Architecture-Neutral
• Java Is Portable
• Java's Performance
• Java Is Multithreaded
Java Is Dynamic
•www.cs.armstrong.edu/liang/intro6e/JavaCharacteristics.pdf
Characteristics of Java
• Java Is Simple Java is partially modeled on C++, but
greatly simplified and improved. Some
• Java Is Object-Oriented people refer to Java as "C++--" because it
• Java Is Distributed is like C++ but with more functionality and
fewer negative aspects.
• Java Is Interpreted
• Java Is Robust
• Java Is Secure
• Java Is Architecture-Neutral
• Java Is Portable
• Java's Performance
• Java Is Multithreaded
• Java Is Dynamic
Characteristics of Java
• Java Is Simple Java is inherently object-oriented.
Although many object-oriented
• Java Is Object-Oriented languages began strictly as procedural
• Java Is Distributed languages, Java was designed from
the start to be object-oriented. Object-
• Java Is Interpreted oriented programming (OOP) is a
• Java Is Robust popular programming approach that is
replacing traditional procedural
• Java Is Secure programming techniques.
• Java Is Architecture-Neutral
One of the central issues in software
• Java Is Portable development is how to reuse code.
• Java's Performance Object-oriented programming provides
great flexibility, modularity, clarity, and
• Java Is Multithreaded reusability through encapsulation,
• Java Is Dynamic inheritance, and polymorphism.
Characteristics of Java
• Java Is Simple Distributed computing involves several
computers working together on a
• Java Is Object-Oriented network. Java is designed to make
• Java Is Distributed distributed computing (e.g. Web
Services) easy. Since networking
• Java Is Interpreted capability is inherently integrated into
• Java Is Robust Java, writing network programs is like
sending and receiving data to and from
• Java Is Secure a file.
• Java Is Architecture-Neutral
• Java Is Portable
• Java's Performance
• Java Is Multithreaded
• Java Is Dynamic
Characteristics of Java
• Java Is Simple You need an interpreter to run Java
programs. The programs are compiled
• Java Is Object-Oriented into the Java Virtual Machine code
• Java Is Distributed called bytecode. The bytecode is
machine-independent and can run on
• Java Is Interpreted any machine that has a Java
• Java Is Robust interpreter, which is part of the Java
Virtual Machine (JVM).
• Java Is Secure
• Java Is Architecture-Neutral
• Java Is Portable
• Java's Performance
• Java Is Multithreaded
• Java Is Dynamic
Characteristics of Java
• Java Is Simple Java compilers can detect many
problems that would first show up at
• Java Is Object-Oriented execution time in other languages.
• Java Is Distributed
Java has eliminated certain types of
• Java Is Interpreted error-prone programming constructs
• Java Is Robust found in other languages.
• Java Is Secure Java has a runtime exception-handling
• Java Is Architecture-Neutral feature to provide programming
support for robustness.
• Java Is Portable
• Java's Performance
• Java Is Multithreaded
• Java Is Dynamic
Characteristics of Java
• Java Is Simple
• Java Is Object-Oriented
• Java Is Distributed
• Java Is Interpreted
Java implements several security
• Java Is Robust mechanisms to protect your system
• Java Is Secure against harm caused by stray
programs.
• Java Is Architecture-Neutral
• Java Is Portable
• Java's Performance
• Java Is Multithreaded
• Java Is Dynamic
Characteristics of Java
• Java Is Simple
• Java Is Object-Oriented
• Java Is Distributed
• Java Is Interpreted
• Java Is Robust
• Java Is Secure
• Java Is Architecture-Neutral Write once, run anywhere
• Java Is Portable With a Java Virtual Machine (JVM),
• Java's Performance you can write one program that will
run on any platform.
• Java Is Multithreaded
• Java Is Dynamic
Characteristics of Java
• Java Is Simple
• Java Is Object-Oriented
• Java Is Distributed
• Java Is Interpreted
• Java Is Robust
• Java Is Secure
• Java Is Architecture-Neutral
• Java Is Portable Because Java is architecture neutral,
Java programs are portable. They can
• Java's Performance be run on any platform without being
• Java Is Multithreaded recompiled.

• Java Is Dynamic
Characteristics of Java
• Java Is Simple
• Java Is Object-Oriented
• Java Is Distributed
• Java Is Interpreted
• Java Is Robust
• Java Is Secure
• Java Is Architecture-Neutral
• Java Is Portable Because Java is architecture neutral,
Java programs are portable
• Java's Performance (moveable). They can be run on any
• Java Is Multithreaded platform without being recompiled.

• Java Is Dynamic
Characteristics of Java
• Java Is Simple
• Java Is Object-Oriented
• Java Is Distributed
• Java Is Interpreted
• Java Is Robust
• Java Is Secure
• Java Is Architecture-Neutral
• Java Is Portable
• Java's Performance Multithread programming is smoothly
• Java Is Multithreaded integrated in Java, whereas in other
languages you have to call procedures
• Java Is Dynamic specific to the operating system to enable
multithreading.
Characteristics of Java
• Java Is Simple
• Java Is Object-Oriented
• Java Is Distributed
• Java Is Interpreted
• Java Is Robust
• Java Is Secure
• Java Is Architecture-Neutral
• Java Is Portable
Java was designed to adapt to an evolving
• Java's Performance environment. New code can be loaded on the
• Java Is Multithreaded fly without recompilation. There is no need for
developers to create, and for users to install,
• Java Is Dynamic major new software versions. New features can
be incorporated transparently as needed.
JDK Versions
JDK Beta 1995

JDK 1.0 January 1996

JDK 1.1 February 1997

J2SE 1.2 December 1998

J2SE 1.3 May 2000

J2SE 1.4 February 2002

Java SE 5 September 2004

Java SE 6 December 2006

Java SE 7 July 2011

Java SE 8 (LTS) March 2014

Java SE 9 September 2017


Java SE 10 March 2018

Java SE 11 (LTS) September 2018


Java SE 12 March 2019
Java SE 13 September 2019
Java SE 14 March 2020
Java SE 15 September 2020
Java SE 16 March 2021
Java SE 17 (LTS) September 2021
Java SE 18 March 2022
Java SE 19 September 2022
Java SE 20 March 2023
Java SE 21 (LTS) September 2023

C Programming 19
JDK Editions
• Java Standard Edition (J2SE)
• J2SE can be used to develop client-side standalone
(independant) applications or applets.
• Java Enterprise Edition (J2EE)
• J2EE can be used to develop server-side
applications such as Java servlets and Java
ServerPages.
• Java Micro Edition (J2ME).
• J2ME can be used to develop applications for
mobile devices such as cell phones.
Java IDE Tools
• Borland JBuilder
• NetBeans Open Source by Sun
• Sun ONE Studio by Sun MicroSystems
• Eclipse Open Source by IBM
Anatomy of a Java Program
• Comments
• Package
• Reserved words
• Modifiers
• Statements
• Blocks
• Classes
• Methods
• The main method
Comments
In Java, comments are preceded by two slashes
(//) in a line, or enclosed between /* and */ in
one or multiple lines. When the compiler sees
//, it ignores all text after // in the same line.
When it sees /*, it scans for the next */ and
ignores any text between /* and */.
Package
The second line in the program specifies a
package name, for the class Welcome. Javac
command compiles the source code
Welcome.java, then, generates Welcome.class
and store it under a directory which is called as
name of the package.
Reserved Words
Reserved words or keywords are words that have a
specific meaning to the compiler and cannot be used
for other purposes in the program. For example,
public, static, void etc.
(Visibility or Access+)
Modifiers
Java uses certain reserved words called
modifiers that specify the properties of the
data, methods, and classes and how they can
be used. Examples of modifiers are public and
static. Other modifiers are private, final,
abstract, and protected.

public > protected > package (default) >


private
http://java.sun.com/docs/books/tutorial/java/ja
vaOO/accesscontrol.html
Statements
A statement represents an action or a sequence of
actions. The statement
System.out.println("Welcome to Java!") in the
program is a statement to display the greeting
"Welcome to Java!" Every statement in Java ends
with a semicolon (;).
Blocks
A pair of braces in a program forms a
block that groups components of a
program.

public class Test {


public static void main(String[] args) { Class block
System.out.println("Welcome to Java!"); Method block
}
}
Classes
The class is the essential Java construct. A
class is a template or blueprint for objects. To
program in Java, you must understand classes
and be able to write and use them. The
mystery of the class will continue to be
unveiled throughout this book. For now,
though, understand that a program is defined
by using one or more classes.
Methods
What is System.out.println? It is a method: a
collection of statements that performs a
sequence of operations to display a message
on the console. It can be used even without
fully understanding the details of how it
works. It is used by invoking a statement with
a string argument. The string argument is
enclosed within parentheses. In this case, the
argument is "Welcome to Java!" You can call
the same println method with a different
argument to print a different message.
main Method
The main method provides the control of
program flow. The Java interpreter executes
the application by invoking the main method.

The main method looks like this:

public static void main(String[] args) {


// Statements;
}
Summary

• Characteristics of Java

• Versions

• Editions

• Anatomy

C Programming 32
Thank You

C Programming 33

You might also like