0% found this document useful (0 votes)
301 views36 pages

Presentation 2

The document is a seminar presentation on Java submitted in partial fulfillment of a Bachelor of Technology degree. It includes details of the student's 45-day training on core Java concepts where they worked on a City Portal project as a Java developer under two mentors. The presentation covers key Java topics like its introduction and features, tools, primitive types, platform independence, OOPs concepts, interfaces, abstract classes, exceptions, arrays, strings and more.

Uploaded by

sakshi singhal
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)
301 views36 pages

Presentation 2

The document is a seminar presentation on Java submitted in partial fulfillment of a Bachelor of Technology degree. It includes details of the student's 45-day training on core Java concepts where they worked on a City Portal project as a Java developer under two mentors. The presentation covers key Java topics like its introduction and features, tools, primitive types, platform independence, OOPs concepts, interfaces, abstract classes, exceptions, arrays, strings and more.

Uploaded by

sakshi singhal
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/ 36

ARYA INSTITUTE OF ENGINEERING TECHNOLOGY &

MANAGEMENT
A
SEMINAR PRESENTATION
On
JAVA
Submitted
In partial fulfillment
For the award of the Degree of
Bachelor of Technology
In
Computer Science Engineering
SUBMITTED TO- SUBMITTED BY-
Mr. Sanjay Tiwari Sakshi
(Head of Department) (16EAOCS037)

Department of Computer Science Engineering


Rajasthan Technical University, Kota
(2016-2020)
TRAINING
 Completed 45 days training from
13th May 2019-25th June 2019,
Ducat,Noida on core Java.

 Worked on a project named City


Portal

 Role Played: Java Developer

 Mentors-
• Mr. Manish Bhatia (Trainer)
• Mr. Aditya Kumar (Project
Coordinator).
CONTENTS

 Introduction to Java  JDBC


 Features of Java  Packages
 Tools for Java  Exception Handling
 Arrays
 Primitive Types  String
 Platform Independent  How to Create a string
 'this' Keyword Object
 'super' Keyword
 OOPs Concepts in Java
 Interface
 Abstarct Class
INTRODUCTION TO JAVA

 Java is developed by James Goslings in Sun Microsystems.


 This language was initially named as 'OAK' and later renamed as JAVA.

Java is a computer programming language that is


 Concurrent
 Dynamic
 Interpreted and compiled
 Automatic memory managment
FEATURES OF JAVA

 Platform Independent
 Robust
 Object-Oriented
 Highly Secure
 Portable
 Multithreaded
 High Performance
 Interpreted
 Dynamic
TOOLS FOR JAVA

 JDK - The Java


Development Kit (JDK) is a
software development
environment used for
developing Java applications
and applets. It includes the
Java Runtime Environment
(JRE), an interpreter/loader
(Java), a compiler (javac), an
archiver (jar), a
documentation generator
(Javadoc) and other tools
needed in Java
development.
 JVM- Java Virtual Machine is a
virtual machine that enables a
computer to run java programs. A
runtime instance of JVM has a clear
mission to run one java application.
 JRE- JRE is the
implementation of JVM, it
provides a platform to
execute java programs.

 It consists of JVM and


library classes to execute
any program successfully.

 It does not contain any


development tools like java
compiler, debugger etc.
PRIMITIVE TYPES

 int 4 bytes
 short 2 bytes
 long 8 bytes Behaviors is
 byte 1 byte
exactly as in
 float 4 bytes
C++
 double 8 bytes
 char Unicode encoding (2 bytes)
 boolean {true,false}
Note:
Primitive type
always begin
with lower-case
PLATFORM INDEPENDENT

myprog.c myprog.exe
gcc machine code
C source code

OS/Hardware

myprog.java myprog.class
javac bytecode
Java source code

JVM

OS/Hardware
'this' KEYWORD

 'this' is a reference variable which


hold the reference id of current
object.

 'this' keyword cannot be used in


static function.

 From jdk 1,8, you can have 'this' as


an argument in any function & it
must be the first argument.
INHERITANCE IN JAVA

Inheritance in java is a
mechanism in which one
object accquires all the
properties and behavior of
parent object.
The idea behind
inheritance is to create
new classes that are built
upon existing classes.
'super' KEYWORD

 The 'super' keyword is a reference


variable which is used to refer
immediate parent class object.

 super' keyword is used at three


levels:
 at variable level
 at method level
 at constructor level
POLYMORPHISM IN JAVA
Polymorphism in Java is a concept by
which we can perform a single action
in different ways. So polymorphism
means many forms.

There are two types of polymorphism


in Java:
 compile-time polymorphism
 runtime polymorphism. We can
perform polymorphism in java by
method overriding.
Example of Java Runtime Polymorphism
COMPILE TIME POLYMORPHISM
• If a class has multiple methods
having same name but different in
parameters, it is known as Method
Overloading.

Method Overloading and


Type Promotion
ENCAPSULATION IN JAVA
Encapsulation in Java is a mechanism of wrapping
the data (variables) and code acting on the data
(methods) together as a single unit.

In encapsulation, the variables of a class will be


hidden from other classes.

To achieve encapsulation in Java −


 Declare the variables of a class as private.
 Provide public setter and getter methods to
modify and view the variables values.
CLASS IN JAVA

Class is the representation of similar


type of objects and it is an
implementation of encapsulation.

A class is a user defined blueprint or


prototype from which objects are
created.It represents the set of
properties or methods that are
common to all objects of one type.
OBJECTS IN JAVA

 The object is an instance of a class.


 An object is a real-world entity.
 An object is a runtime entity.
 The object is an entity which has
state and behavior.
ABSTRACTION
In Object-oriented programming, abstraction is a process of hiding the
implementation details from the user, only the functionality will be provided to the
user. In other words, the user will have the information on what the object does
instead of how it does it.

For example, when you consider the case of e-mail, complex details such as what
happens as soon as you send an e-mail, the protocol your e-mail server uses are
hidden from the user.
 In Java, abstraction is achieved using Abstract classes and interfaces.
INTERFACES
 An interface in java is a blueprint of
a class. It has static constants and
abstract methods.

 The interface in Java is a


mechanism to achieve abstraction.
It is used to achieve abstraction and
multiple inheritance in Java.

 Interfaces are never made to


represent any object.
ABSTRACT CLASS

 A class which is declared as


abstract is known as an abstract
class.

 It can have abstract and non-


abstract methods. It needs to be
extended and its method
implemented.

 It cannot be instantiated.
JDBC
 JDBC provides us certain APIs to
connect the java program to any
database to perform curd
operations.

 JDBC API uses JDBC drivers to


connect with the database

 JDBC can also be defined as the


platform-independent interface
between a relational database and
Java programming. It allows java
program to execute SQL statement
and retrieve result from database.
TYPES OF JDBC DRIVER

1. JDBC-ODBC bridge driver:


The JDBC-ODBC bridge driver uses
ODBC driver to connect to the database.
The JDBC-ODBC bridge driver converts
JDBC method calls into the ODBC function
calls.
This is now discouraged because of thin
driver.
2. Native-API driver:
The Native API driver uses the
client-side libraries of the
database. The driver converts
JDBC method calls into native
calls of the database API. It is not
written entirely in java.
3. Network Protocol driver:
The Network Protocol driver uses
middleware (application server) that
converts JDBC calls directly or
indirectly into the vendor-specific
database protocol. It is fully written in
java.
4. Thin driver:
The thin driver converts JDBC
calls directly into the vendor-
specific database protocol. That is
why it is known as thin driver. It is
fully written in Java language.
PACKAGES

A package as the name suggests is a


pack(group) of classes, interfaces and
other packages. In java we use
packages to organize our classes and
interfaces.

 We have two types of packages in


Java:
1. built-in packages
2. user-defined packages
EXCEPTION HANDLING IN JAVA

An exception (or exceptional event) is a problem that arises during the


execution of a program and distrupts the normal flow of program.
An exception can occur for many different reasons.

Following are some scenarios where an exception occurs.

 A user has entered an invalid data.


 A network connection has been lost in the middle of communications or the
JVM has run out of memory.
EXCEPTION HIERARCHY
ARRAYS

 Java array is an object which


contains elements of a similar data
type.

 Additionally, The elements of an


array are stored in a contiguous
memory location.
 Code Optimization: It makes the code optimized, we can retrieve or sort the data
efficiently.

 Random access: We can get any data located at an index position.

 Size Limit: We can store only the fixed size of elements in the array. It doesn't
grow its size at runtime. To solve this problem, collection framework is used in
Java which grows automatically.
STRING
Basically, string is an object which represents sequence of characters but it's not a
primitive type.

When we create a string in java, it actually creates an object of type String.


String is immutable object which means that it cannot be changed once it is
created.

char[] ch={'j','a','v','a','t','p','o','i','n','t'};
String s=new String(ch);
String is the only class where operator overloading is supported in java.
How to create a string object?

There are two ways to create String


object:
• By string literal
• By new keyword

1) String Literal
Java String literal is created by using
double quotes. For Example:
String s="hello";
2) By new keyword
String s=new String("Welcome");//creates two objects and one reference variable.
In such case, JVM will create a new string object in normal (non-pool) heap
memory, and the literal "Welcome" will be placed in the string constant pool. The
variable s will refer to the object in a heap (non-pool).

SOME IMPORTANT METHODS OF STRING CLASS:

1. Boolean equals(Object another)


2. String concat(String str)
3. String toUpperCase()
4. String toLowerCase()
5. char charAt(int index)
6. int length()

You might also like