Java Module I
Java Module I
UNIVERSITY
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
JAVA PROGRAMMING
(JP)
B.Tech. – CSE / AIML / DS
BBA / BCA
Academic Year : 2024-25
Term – I
MODULE-I
Compiled by Ms. K. Jayasri, CSE,
03/23/25 1
Aurora University
Compiled by Ms. K. Jayasri, CSE,
03/23/25 2
Aurora University
Objectives
1.Explain object oriented concepts in Java
2.Identify suitable inhertiance for real world
applications and demonstrate packages.
3.Develop database applications using JDBC
4.Build applications capable for multitasking.
5.Develop GUI applications using Swing and
JavaFX
CO4: Utilize auto boxing, annotations, and JDBC for effective database
connectivity and management.
CO5: Develop GUIs using Swing and JavaFX, understanding and employing
their basic components and controls.
Pre –Requisites
Programming IDEs
SUGGESTED READING
•String classes
•Constructors
•This keyword
•the Finalized( ) method.
Compiled by Ms. K. Jayasri, CSE,
03/23/25 9
Aurora University
Introduction to Java
•Java is an Object-Oriented
programming language developed
by James Gosling in the early
1990s, later acquired by Oracle
Corporation.
•Android development,
•web applications,
•governmental websites, big data technologies like
Hadoop and Apache Storm, and
•scientific projects like natural language processing.
It has been a dominant player in the mobile industry
since the early 2000s.
Java has gone through several major versions since its inception.
Here's a brief overview of the key versions
1.Java 1.0 (1996) - The original release, introducing core language
features and the Java Virtual Machine (JVM).
2.Java 1.1 (1997) - Added features like inner classes, JavaBeans,
and the event model.
3.Java 2 (Java 1.2) (1998) - Major overhaul with the introduction
of the Collections Framework, Swing GUI toolkit, and more.
4.Java 5 (Java 1.5) (2004) - Introduced generics, metadata
annotations, enumerated types, and enhanced for-loops.
5.Java 6 (2006) - Focused on performance improvements, scripting
support via the Java Compiler API, and enhancements to web
services.
6.Java 7 (2011) - Introduced features like the try-with-resources
statement, diamond operator, and improved exception handling.
Compiled by Ms. K. Jayasri, CSE,
03/23/25 14
Aurora University
Java Versions
• Java 8 (2014) - Major update introducing lambda
expressions, the Stream API, and the new Date and Time
API.
• Java 9 (2017) - Introduced the module system (Project
Jigsaw), JShell (REPL), and improved Javadoc.
• Java 10 (2018) - Included local-variable type inference (var)
and improvements in the garbage collector.
• Java 11 (2018) - Long-Term Support (LTS) release with
features like the HTTP Client and removal of some
deprecated features.
• Java 12 (2019) - Added features like switch expressions
(preview) and a new garbage collector (Shenandoah).
• Java 13 (2019) - Included text blocks (preview) and
improvements to the switch expression.
Java syntax is based on C++ (so easier for programmers to
learn it after C++).
Java has removed many confusing and rarely-used features
Portable
Java is portable because it facilitates you to carry the
java bytecode to any platform. It doesn't require any
type of implementation.
• Example:
• class Car {
• String color;
• void start() {
• System.out.println("Car is starting");
• }
• }
• Example:
• String str = "Hello, World!";
• System.out.println(str.length());
• System.out.println(str.substring(0, 5));
•• • Constructor: Initializes a new object.
Constructors
• No return type, same name as class.
• class Person {
• String name;
• int age;
• Person(String name, int age) {
• this.name = name;
• this.age = age;
• }
• void display() {
• System.out.println(name + " is " + age + " years old.");
• }
• }
• Example:
• class Example {
• int value;
• Example(int value) {
• this.value = value;
• }
• void display() {
• System.out.println("Value: " + this.value);
• }
• }
• Example:
class Demo {
@Override
protected void finalize() throws Throwable {
System.out.println("Object is being garbage collected");
}
public static void main(String[] args) {
Demo obj = new Demo();
obj = null;
System.gc();
}
}
Summary
• • Java Architecture: JVM, JRE, JDK
• • JVM Components: Class Loader, Bytecode
Verifier, Execution Engine, Garbage Collector
• • Core Concepts: Classes, Objects, Strings,
Constructors, 'this' keyword, finalize() method
Questions
• Thank you!
• Any questions?
Thank You!