Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
2 views

Java Dev

The document covers key concepts in Java programming, including generics, collections framework, and RDBMS. It explains the use of generic methods and classes, various collection types like Vectors and HashMaps, and the importance of synchronization in concurrent programming. Additionally, it details JDBC types for database connectivity, emphasizing the different methods of connecting Java applications to databases.

Uploaded by

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

Java Dev

The document covers key concepts in Java programming, including generics, collections framework, and RDBMS. It explains the use of generic methods and classes, various collection types like Vectors and HashMaps, and the importance of synchronization in concurrent programming. Additionally, it details JDBC types for database connectivity, emphasizing the different methods of connecting Java applications to databases.

Uploaded by

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

UNIT 1

GENERIC PROGRAMMING
Generics are used to create such classes, interfaces, and methods with parameters that can
operate on different data types along.

Java Generic methods and generic classes enable programmers to specify, with a single method
declaration, a set of related methods, or with a single class declaration, a set of related types,
respectively.

Generic Methods

You can write a single generic method declaration that can be called with arguments of different
types. Based on the types of the arguments passed to the generic method, the compiler handles
each method call appropriately.

Generic Class

A generic class declaration looks like a non-generic class declaration, except that the class name
is followed by a type parameter section.

UNIT 2
COLLECTIONS FRAMEWORK
Collections

• Interfaces − These are abstract data types that represent collections. Interfaces allow
collections to be manipulated independently of the details of their representation.
In object-oriented languages, interfaces generally form a hierarchy.

• Implementations, i.e., Classes − These are the concrete implementations of the


collection interfaces. In essence, they are reusable data structures.

• Algorithms − These are the methods that perform useful computations, such as
searching and sorting, on objects that implement collection interfaces. The algorithms
are said to be polymorphic: that is, the same method can be used on many different
implementations of the appropriate collection interface.

Vectors

Vector is like the dynamic array which can grow or shrink its size. Unlike array, we can store n-
number of elements in it as there is no size limit. It is a part of Java Collection framework since
Java 1.2. It is found in the java.util package and implements the List interface, so we can use all
the methods of List interface here.

Hashtable
Hashtable in Java is a data structure in which each key is unique and is used to store key-value
pairs. It belongs to Java.util package, which implements Map interface in order to work with the
elements it includes. An important characteristic of a Hashtable is its capability of providing
rapid lookup and insertion operations.

Java Enumeration

The enum in Java is a data type. It is used when we need to represent a fixed set of constants.

It can be used for days of the week (SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY,
FRIDAY, and SATURDAY), directions (NORTH, SOUTH, EAST, and WEST), season (SPRING,
SUMMER, WINTER, and AUTUMN or FALL), colors (RED, YELLOW, BLUE, GREEN, WHITE, and
BLACK) etc.

Type Casting

Type casting in Java is a fundamental concept that allows developers to convert data from one
data type to another. It is essential for handling data in various situations, especially when
dealing with different types of variables, expressions, and methods.

ArrayList

ArrayList in Java is a dynamic array implementation that belongs to the Java Collections
Framework. This is a big array that grows on its own as more elements are added to it.

HashMap

Java HashMap class implements the Map interface which allows us to store key and value pair,
where keys should be unique. If you try to insert the duplicate key, it will replace the element of
the corresponding key. It is easy to perform operations using the key index like updation,
deletion, etc.

Iterators

In Java, an Iterator is one of the Java cursors. Java Iterator is an interface that is practiced in
order to iterate over a collection of Java object components entirety one by one. It is free to use
in the Java programming language since the Java 1.2 Collection framework. It belongs to
java.util package.

Object Synchronization

Synchronization in Java is a critical concept in concurrent programming that ensures multiple


threads can interact with shared resources safely. In a nutshell, synchronization prevents race
conditions, where the outcome of operations depends on the timing of thread execution. It is
the capability to control the access of multiple threads to any shared resource. Synchronization
is a better option where we want to allow only one thread to access the shared resource.

UNIT 3
RDBMS

RDBMS stands for Relational Database Management System.

RDBMS is a program used to maintain a relational database.


RDBMS is the basis for all modern database systems such as MySQL, Microsoft SQL Server,
Oracle, and Microsoft Access.

RDBMS uses SQL queries to access the data in the database.

JDBC

JDBC (Java Database Connectivity) is an API in Java that enables applications to interact with
databases. It allows a Java program to connect to a database, execute queries, and retrieve and
manipulate data.

• Type 1 − a JDBC bridge is used to access ODBC drivers installed on each client machine.
For example, JDBC-ODBC Bridge driver in JDK 1.2.

• Type 2 − JDBC API calls are converted into native C/C++ API calls, which are unique to the
database. These APIs are vendor specific and vendor provided driver is required to be
installed. It is also called JDBC Native API. For example, Oracle Call Interface (OCI) driver.

• Type 3 − A three-tier approach is used to access databases. The JDBC clients use
standard network sockets to communicate with a middleware application server. The
socket information is then translated by the middleware application server into the call
format required by the DBMS, and forwarded to the database server. It is also called
JDBC-Net Pure Java driver.

• Type 4 − A pure Java-based driver communicates directly with the vendor's database
through socket connection. This is the highest performance driver available for the
database and is usually provided by the vendor itself. For example, MySQL's Connector/J
driver to connect to MySQL database.

You might also like