coderz.py

Keep Coding Keep Cheering!

EnumSet in Java

What is EnumSet in Java? The EnumSet is a specialized implementation of the Set interface designed for use with enumeration types. It derives from the AbstractSet class and implements the Set interface. Enum sets are internally represented as bit vectors. This is a very compact and efficient representation. This class’s space and time performance should […]

September 13, 2022 | Java | 1 comment

AbstractSet in Java

AbstractSet is a Java Collection Framework class that implements the Collection interface and extends the AbstractCollection class. It implements the Set interface in its most basic form. This class does not override any of the AbstractCollection class’s implementations, but instead adds equals() and hashCode() methods. Class Hierarchy: Syntax: Where E is the type of elements […]

September 12, 2022 | Java | 1 comment

CopyOnWriteArrayList class

The CopyOnWriteArrayList class, which implements the List interface, is introduced in JDK 1.5. It is an enhanced version of ArrayList in which all changes (add, set, remove, and so on) are implemented by making a new copy. It is included in the java.util.concurrent package. Furthermore, it is a data structure that was created for use […]

September 10, 2022 | Java | No comments

AbstractSequential List in Java

The Java Collection Framework includes the AbstractSequential List class, which implements the Collection interface, and the AbstractCollection class. It is used to implement an unmodifiable list, for which one needs to only extend this AbstractList Class and implement only the get() and the size() methods. AbstractSequential List Method: Method Description add(int index, E element) Inserts […]

September 9, 2022 | Java | No comments

Abstract List in Java

This class provides a skeletal implementation of the List interface in order to reduce the effort required to implement this interface in combination with a “random access” data store (such as an array). Abstract List should be used instead of this class for sequential access data (such as a linked list). Declaration:  Methods of Abstract […]

September 9, 2022 | Java | No comments

File class in Java

The File class represents a file or directory path name in Java. Because file and directory names differ between platforms, naming them with a simple string is insufficient. The File class is used to create files and directories, search for files, delete files, and so on. Fields of File Class Modifier Type Field Description static String pathSeparator It is a path-separator character that is system-dependent and is represented as a string for convenience. static char pathSeparatorChar It is a path-separator character that is system-dependent. static […]

September 7, 2022 | Java | No comments

Inner class in Java

In Java, an inner class is a class that is declared within another class or interface. To summarize, the same logically related classes as Java is purely object-oriented, bringing it closer to the real world.It also has access to all the outer class’s members, including private data members and methods. Syntax: Why do we use […]

September 6, 2022 | Java | No comments

Java connectivity to MongoDB database

MongoDB is a no-SQL database that is document-oriented. MongoDB, which was first released in 2009, successfully replaced rows and columns in traditional relational data models with documents. We do not need to use the JDBC API to connect to MongoDB because its API is completely independent and does not require any other external library. Prerequisites: […]

September 5, 2022 | Java | No comments

Using the Thin Driver to Connect to an Oracle Database

Follow the steps below to connect a Java application to an Oracle database using Thin Driver. Download Oracle JDBC Driver Load Driver Class JDBC Connection Load the jar file Download Oracle JDBC Driver: Visit Oracle database website and download the Oracle JDBC Driver. Load Driver Class: The Oracle database Driver Class is oracle.jdbc.driver.OracleDriver and the Class.forName(“oracle.jdbc.driver.OracleDriver”) method […]

September 5, 2022 | Java | No comments

Java connect to MySQL database with JDBC

Follow the steps below to connect a Java application to a MySQL database using the JDBC Driver. Download JDBC driver for MySQL No need to load MySQL driver class explicitly Understand the getConnection() method of DriverManager class Java code example connects to MySQL database Download JDBC driver for MySQL: To begin, a JDBC driver for […]

September 4, 2022 | Java | No comments

Advertisement