Programming Articles

Page 1676 of 2547

Java DatabaseMetaData getURL() method with example

Alshifa Hasnain
Alshifa Hasnain
Updated on 06-Mar-2025 589 Views

In this article, we will learn about the DatabaseMetaData getURL() method in Java. The DatabaseMetaData interface provides useful methods to obtain details about the database and the JDBC driver. One such method is getURL(), which returns the URL of the JDBC driver being used. What is the getURL() Method? The getURL() method in Java's DatabaseMetaData interface is used to retrieve the URL of the database to which the current connection is established. Syntax String dbUrl = metaData.getURL(); This method retrieves the URL of the underlying Database Management System and returns it in the form of a String variable. ...

Read More

Java program to map string list to lowercase and sort

Alshifa Hasnain
Alshifa Hasnain
Updated on 03-Mar-2025 874 Views

In this article, we will learn to map a String list to lowercase and sort in Java. We need to manipulate the elements of a list, such as converting all strings to lowercase and sorting them. This is particularly useful when dealing with user input, file processing, or data normalization. Problem Statement Given a list of strings, we want to convert all strings to lowercase and sort the list in reverse alphabetical order.For Example: Input ["Apple", "banana", "Cherry", "date"] Output ["date", "cherry", "banana", "apple"] Using Streams API The Streams API provides a useful and functional approach to processing ...

Read More

Java program to display date and time information in uppercase

Alshifa Hasnain
Alshifa Hasnain
Updated on 03-Mar-2025 759 Views

In this article, we will learn to display the date and time in uppercase using Java. Working with date and time in Java is a common requirement in various applications, logging, scheduling, or data processing. Different Approaches The following are the two different approaches to display the date and time in uppercase using Java − Using Formatter and Calendar Using DateTimeFormatter Using Formatter and Calendar The Formatter class in Java allows us to format date and time using the %Tc specifier. We can then convert the output to uppercase using ...

Read More

C++ Program to Sum the digits of a given number

Nishu Kumari
Nishu Kumari
Updated on 03-Mar-2025 15K+ Views

The task is to write C++ programs that calculates the sum of the digits of a given number. For example, if the number is 453, the sum of its digits would be 4 + 5 + 3 = 12. To solve this, we will extract each digit from the number and add them together. We will use basic programming concepts such as loops and arithmetic operations to achieve this. In this article, we will show you how to write a C++ program that takes a number as input and sums the digits of that number. Approaches for ...

Read More

C++ Program to Implement Min Heap

Nishu Kumari
Nishu Kumari
Updated on 03-Mar-2025 12K+ Views

In this article, we will write a C++ program that implements a Min Heap. A Min Heap is a binary tree where the value of each node is less than or equal to the values of its children. We will explain how to create a Min Heap using arrays and implement operations like insertion and deletion. The article will cover the following topics: What is a Heap? Types of Heap Representing a Heap What is a Min Heap? What ...

Read More

Is string a primitive data type or an object in Java?

Alshifa Hasnain
Alshifa Hasnain
Updated on 28-Feb-2025 2K+ Views

In Java there are various data types present, the String type often leads to confusion regarding whether it is a primitive data type or an object(non-primitive data type ).  Primitive Data Types in Java Primitive data types are the most basic data types the Java language provides. Primitive data types are not objects and do not have methods or properties. Eg: int (32-bit), float(32-bit), double(64-bit ), etc.  What is String in Java? A string is not a primitive data type. Java.lang package provides the String class therefore, it is an object type. The String class provides methods to manipulate and operate ...

Read More

Can a final class be subclassed in Java?

Alshifa Hasnain
Alshifa Hasnain
Updated on 27-Feb-2025 2K+ Views

In Java Inheritance is a fundamental feature that allows a class to derive properties and behaviors from another class. In Java, not all classes can be subclassed. A final class is a special type of class that cannot be extended.  What is a Final Class in Java? In Java, a class is declared final using the final keyword. The final modifier for finalizing the implementations of classes, methods, and variables. When a class is marked as final, it means − It cannot be extended. All its methods remain unchanged in their ...

Read More

How to declare a local variable in Java?

Alshifa Hasnain
Alshifa Hasnain
Updated on 27-Feb-2025 1K+ Views

In Java, local variables are those that have been declared within a method, constructor, and block, and are only accessible within that defined scope. Such local variables are used when there is a need to store temporary data during the execution of a program. What is a Local Variable? Local variables are declared in methods, constructors, or blocks. Local variables are created when the method, constructor, or block is entered and the variable will be destroyed once it exits the method, constructor, or block. A local variable is a variable that is − Declared inside ...

Read More

Java ResultSetMetaData getScale() method with example

Alshifa Hasnain
Alshifa Hasnain
Updated on 27-Feb-2025 610 Views

In this article, we will learn the ResultSetMetaData getScale() method in Java. The ResultSetMetaData interface provides metadata about the columns in a ResultSet object. The getScale() method returns the number of digits to the right of the decimal point for a specified column. What is the getScale() method? The getScale() method of the ResultSetMetaData (interface) retrieves the number of digits after the right of the decimal point in the given column. This method accepts an integer value representing the index of a column. and returns an integer value representing the number of digits after the decimal in the specified column. Syntax ...

Read More

Java DatabaseMetaData getDriverName() method with example

Alshifa Hasnain
Alshifa Hasnain
Updated on 27-Feb-2025 507 Views

In this article, we will learn about the DatabaseMetaData getDriverName() method in Java. The DatabaseMetaData interface provides useful methods to obtain details about the database and the JDBC driver. One such method is getDriverName(), which returns the name of the JDBC driver being used. What is getDriverName() in Java? The getDriverName() method belongs to the DatabaseMetaData interface in Java's JDBC API. It retrieves the name of the JDBC driver currently connected to the database. Syntax String driver_name = metaData.getDriverName(); The method returns the following values − Returns a String representing the name of the ...

Read More
Showing 16751–16760 of 25,466 articles
Advertisements