Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles on Trending Technologies
Technical articles with clear explanations and examples
Java sql.Time valueOf() method with example
In this program, we'll demonstrate how to insert and retrieve records from a MySQL database using JDBC . Specifically, we'll focus on how to convert a time value from a String format into a java.sql.Time object using the valueOf() method. This allows us to store time values in a database and retrieve them accurately. Time time = Time.valueOf("time_string"); Steps to Use sql.Time valueOf() Method Following are the steps to use sql.Time valueOf() method − Import all the useful classes. Register the Driver by loading the MySQL JDBC driver. ...
Read MoreLongest consecutive subsequence in C++
Given an array of integers, determine the length of the longest subsequence where the elements are consecutive integers, regardless of their order within the subsequence. Input arr = {100, 4, 200, 1, 3, 2} Output Length of the longest consecutive sequence is: 4 Different approaches for longest consecutive subsequence The following are the approaches to get longest consecutive subsequence By sorting the Array By using Set Approach 1: By Sorting the ArrayBelow are the steps to get the longest consecutive subsequence in C++ using Array Sort ...
Read MoreClear bit ranges in given number in C++
Given a number n, write C++ program to clear bits in the given range between l and r. Where, 1
Read MoreTop 10 Best WordPress CDN Plugins
If you want your WordPress site to load faster and provide a better experience for your visitors, using a Content Delivery Network (CDN) can be a game-changer. A CDN helps distribute your website’s content across various servers around the world, so when someone visits your site, it loads from the server closest to them. This speeds up the loading time and can improve your site's performance. To make things easier, there are many CDN plugins available for WordPress. Here’s a list of the top 10 best WordPress CDN plugins that can help you optimize your site’s speed ...
Read MoreJava program to get the beginning and end date of the week
In this article, we'll explore how to determine the start and end dates of a week using Java. Specifically, we'll write a program that takes a given date and calculates the Monday and Sunday of that week. Problem Statement Write a Java program to find the beginning (Monday) and end (Sunday) dates of the week for a given date. Input Date = 2019-04-16 Output Start of the Week = 2019-04-15End of the Week = 2019-04-21 Steps to calculate week's start and end dates Following are the steps to get the beginning and end date of the week − ...
Read MoreJava program to determine when a Frame or Window is closing
In this article, we will learn to determine when a Frame or Window is closing in Java. We will create a simple window in Java Swing titled "Demo". It displays styled text (italic, black on orange) using a text pane inside a scrollable area. The program also listens for window-closing events, printing a message when you close it. This basic example is how to build a GUI with text styling and event handling.Steps to determine when a Frame or Window is closing Following are the steps to determine when a Frame or Window is closing in Java − ...
Read MoreJava program to find the sum of a series 1/1! + 2/2! + 3/3! + 4/4! +…….+ n/n!
In this program, we'll compute the sum of the series 1/1! + 2/2! + 3/3! + ... + n/n! using Java. This involves calculating factorials and summing the results of each term divided by its factorial. We'll use Java's basic arithmetic, loop control, and built-in classes to achieve this.Problem StatementWrite a Java program to calculate the sum of the series 1/1! + 2/2! + 3/3! + ... + n/n! and print the result.Steps to find the sum of a seriesFollowing are the steps to find the sum of a series −Import necessary classes from java.io and java.lang package.Initialize variables for the sum and ...
Read MoreJava program to find cube root of a number using binary search
The cube root of a number is an integer value when multiplied by itself thrice, giving the original number. In this article, we are going to write a Java program to find the cube root of a number using binary search. Finding the cube root of a number is one of the applications of the binary search algorithm. We will discuss in detail how we calculate the cube root using a binary search algorithm in Java. Problem Statement Write a Java program to find the cube root of a number using Binary Search − Input 1 64 Output 1 4 ...
Read MoreJava program to find 2 elements in the array such that difference between them is largest
In this problem, we will find two array elements such that the difference between them is maximum using Java. We can make a pair of each element and find the difference between the elements of each pair. After that, we can take a pair whose element has a maximum difference. Another approach is to sort the array and take the largest and smallest elements from the array. Problem statement We have given an array containing the integer values. We need to find two array elements to maximize the difference between them. Input 1 array[] = { 50, 10, 30, ...
Read MoreJava program to set horizontal alignment of content in a JTextField
In this article, we will learn how to set the horizontal alignment of content in a JTextField class using Java Swing. The content in the JTextFile is by default left aligned, but you can change it using the setHorizontalAlignment() method. Steps to Set Horizontal Alignment of Content in a JTextField Following are the steps to set the Horizontal Alignment of content in a JTextField − Import the required Java Swing packages. Create a JFrame and set layout manager. Create JLabel and JTextField then set horizontal alignment. ...
Read More