Samual Sam has Published 2310 Articles

Java Program to add minutes to current time using Calendar.add() method

Samual Sam

Samual Sam

Updated on 17-Jul-2024 13:12:22

3K+ Views

Java provides a built-in class called Calendar that allows developers to work with dates and times in their applications. The Calendar class provides various methods to manipulate dates and times, such as adding or subtracting days, months, years, hours, minutes, and seconds. Problem Statement Write a Java program to increment ... Read More

Java Program to subtract months from current date using Calendar.add() method

Samual Sam

Samual Sam

Updated on 08-Jul-2024 18:03:44

3K+ Views

When working with dates in Java, it's common to need to increment or decrement months. The Calendar class makes it easy to manipulate dates. This article shows how to decrement the current date by a specified number of months using the Calendar class. Problem Statement Given a Java program to ... Read More

Java program to check if a string is a valid number

Samual Sam

Samual Sam

Updated on 05-Jul-2024 17:57:00

3K+ Views

In Java, verifying whether a string is a valid number is a common requirement in various applications. This process ensures that the string can be safely converted to a numerical type without causing runtime exceptions. To validate if a string can be converted to these types, we use the Integer.parseInt() ... Read More

Java program to convert LocalDate to java.util.Date in UTC

Samual Sam

Samual Sam

Updated on 02-Jul-2024 10:26:21

5K+ Views

In this article, we will learn how to convert a local date to a java.util.Date in UTC using Java's date and time API. Problem Statement Convert the current date, to a java.util.Date object in Coordinated Universal Time (UTC). The goal is to achieve this conversion while ensuring that the resulting ... Read More

Java program to sort integers in unsorted array

Samual Sam

Samual Sam

Updated on 28-Jun-2024 18:19:18

3K+ Views

Sorting refers to arranging data in a particular format. Sorting algorithm specifies the way to arrange data in a particular order (ascending or descending). Problem Statement For a given array write Java program to sort integers in unsorted array. Consider the following example - Input The unsorted integer ... Read More

Java Program to Toss a Coin

Samual Sam

Samual Sam

Updated on 28-Jun-2024 11:20:56

5K+ Views

Tossing a coin is flipping a coin into the air and letting it fall back down. When you toss a coin, it's like a game where you can choose heads or tails, and the side that lands facing up is the result. This method is used when we want to ... Read More

Difference between an SAP ERP system and DBMS

Samual Sam

Samual Sam

Updated on 25-Jun-2024 16:17:28

3K+ Views

DBMS or Database Management system is basically the tool/interface required to manage the database.  For example, SQL server or a tool like MYSQL workbench is a DBMS. A DBMS is mainly used by or designed for technical people.ERP (Enterprise Resource Planning System) is a complete system with one database and ... Read More

Java Program to convert String to Boolean

Samual Sam

Samual Sam

Updated on 21-Jun-2024 13:09:42

16K+ Views

To convert String to Boolean, use the parseBoolean() method in Java. The parseBoolean() parses the string argument as a boolean. The boolean returned represents the value true if the string argument is not null and is equal, ignoring case, to the string "true".Firstly, declare a string.String str = "false";Now, use ... Read More

Java program to calculate the product of two numbers

Samual Sam

Samual Sam

Updated on 21-Jun-2024 12:47:09

12K+ Views

The * operator in Java is used to multiply two numbers. Read required numbers from the user using Scanner class and multiply these two integers using the * operator.Exampleimport java.util.Scanner; public class MultiplicationOfTwoNumbers {    public static void main(String args[]){       Scanner sc = new Scanner(System.in);     ... Read More

Java Program to locate a character in a string

Samual Sam

Samual Sam

Updated on 21-Jun-2024 11:27:10

15K+ Views

To locate a character in a string, use the indexOf() method.Let’s say the following is our string.String str = "testdemo";Find a character ‘d’ in a string and get the index.int index = str.indexOf( 'd');Example Live Demopublic class Demo {    public static void main(String []args) {       String str ... Read More

Previous 1 ... 5 6 7 8 9 ... 231 Next
Advertisements