You are on page 1of 18

JAVA

PROGRAMMING

-V. Prashanthi
Chapter 1-java evolution
• Java is one of the most popular and widely used programming language and platform. A platform
is an environment that helps to develop and run programs written in any programming language.

• Java is fast, reliable and secure. From desktop to web applications, scientific supercomputers to
gaming consoles, cell phones to the Internet, Java is used in every nook and corner.

11/18/2023 2
• Java is easy to learn, and its syntax is simple and easy to understand. It is based on C++ (so easier for
programmers who know C++). Java has removed many confusing and rarely-used features e.g., explicit
pointers, operator overloading etc. Java also takes care of memory management and for that, it provides
an automatic garbage collector. This collects the unused objects automatically.

11/18/2023 3
11/18/2023 4
11/18/2023 5
11/18/2023 6

Java concepts
with
mobile-phone
scenario
CHAPTER-2 CLASSES AND OBJECTS

•Mobile-phone is an object because it is a real time entity, and


it has its own state, behavior and identity. Mobile-phone are
manufactured in surplus by various companies and each of the
brands have distinct features.

•Classes in java are logical entities which have methods, fields,


constructors and a lot more. In a mobile-phone, you can
consider its specifications as classes, be it
processor/battery/sensors/basic features like call, text, record.

11/18/2023 7
Abstraction:

•Revealing relevant/necessary information and hiding the unwanted


information is abstraction.
•In a mobile-phone, dialing a number would call some method
internally which will concatenate the numbers and displays it on screen
but, we don’t know what is happening internally.
•When you tap on the call option, it is sending signals to another
person’s mobile(whom you are trying to call) but we are unaware of its
implementation.
•So, it is hiding the implementation and showing you the functionality
only.

Encapsulation:
•Enclosing one or more details from outside world through access
rights.
•We have Bluetooth in our mobiles to transfer data between two
mobile-phones within a limited distance.
•If I turn on Bluetooth in both mobiles, I can transfer the desired data,
but I can’t access the other mobile’s information like gallery until and
unless I get a permission from the other mobile.
Polymorphism:
•Performing a job in different ways.(One to many)

•We click photographs and record videos using the camera in a mobile-phone.

•Various brands have a plethora of camera modes in a mobile like split


camera/pan aroma/slow-mo.

•The basic purpose is to click/record, so the functionality of camera is the


same in every mobile, whereas the modes enable you to use your camera in
different ways.

Inheritance:

•One class(sub/child class) is deriving all properties from other class.


(parent class)
•The basic purpose of using a mobile-phone is communication.
•There are several brands in mobiles. So, the brands of a mobile are
using this basic functionality(communication) by extending the mobile
class functionality and adding their own new features to their respective
11/18/2023 brands. 9
 Refer the below site for more concepts:

https://medium.com/front-end-weekly/es6-lets-divide-our-phones-into-classes-
4574bd0454bf
Chapter-3 packages and interfaces

PACKAGES:
Package in Java is a mechanism to encapsulate a group of classes, sub packages and interfaces

11/18/2023 11
 This java android package contains various classes for implementation.
11/18/2023 12
INTERFACE:

An Interface is a group of abstract methods and constants. An Interface may


contain constants, static methods, default methods, and nested types. Default
and static methods have their body in an interface. An Interface cannot be
instantiated
interface Wifi {
void connect();
void disconnect();
}
class Mobile implements Wifi {
public void connect() {
System.out.println("Wifi connected"); }
public void disconnect() {
System.out.println("Wifi disconnected");}
public static void main(String args[]) {
Mobile mobile = new Mobile();
mobile.connect();
mobile.disconnect(); }} //Output
//Wifi connected
///Wifi disconnected
11/18/2023 13
CHAPTER-4 THE COLLECTION FRAMEWORK

 Java collections refer to a collection of individual objects that are


represented as a single unit. You can perform all operations such as
searching, sorting, insertion, manipulation, deletion, etc., on Java
collections just like you do it on data.

 A Java collection framework provides an architecture


to store and manipulate a group of objects. A Java
collection framework includes the following:

• Interfaces
• Classes
• Algorithm

11/18/2023 14
LISTS
GRAPH

SET

STACK
QUEUE

11/18/2023 15
chapter-5 MULTITHREADING
Multithreading is a Java feature that allows concurrent execution of two or more parts of a
program for maximum utilization of CPU. Each part of such program is called a thread. So,
threads are light-weight processes within a process

Accessing multiple tabs using multithreading


11/18/2023 16
Chapter-6 JDBC
• JDBC stands for Java Database Connectivity. JDBC is a Java API to connect and execute the
query with the database. It is a part of Java SE (Java Standard Edition). JDBC API uses JDBC
drivers to connect with the database.

11/18/2023 17
Transaction management [1, 2] refers to the tasks of processing multiple transactions issued by various
clients of a database server in such a way that the ACID contract can be fulfilled, that is, the properties of
atomicity, consistency preservation, isolation, and durability of each individual transaction can be
guaranteed. Transaction management is generally understood as requiring serializability-based concurrency
control as well as recovery from failures.

Paypal uses JAVA for writing application and


transaction management

11/18/2023 18

You might also like