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

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

2K+ 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 decrement the current date by a specified number of months using the Calendar class. Output Current Date = Thu Nov 22 16:37:42 UTC 2018 Updated Date = Thu Mar 22 16:37:42 UTC 2018 Basic Approach Below are the steps to subtract months from current date using Calendar.add() ... Read More

Java Program to Convert Octal to Hexadecimal

Mr. Satyabrata
Updated on 08-Jul-2024 14:11:19

1K+ Views

Octal Number Octal number is also one of the number systems available. The octal number is represented with 8 digits which is from 0 to 7(0, 1, 2, 3... 7). The octal numbers are expressed as base-8 in the numeral system. Hexadecimal Number Hexadecimal number is also one of the number systems available. The hexadecimal number is represented with 16 digits which is from 0 to 15(0, 1, 2, 3... 15). From 10 to 15 it is represented as A to F. The hexadecimal numbers are expressed as base-16 in the numeral system. Problem Statement First convert the octal ... Read More

Java program to delete duplicate lines in text file

Maruthi Krishna
Updated on 08-Jul-2024 12:02:44

2K+ Views

The interface set does not allow duplicate elements. The add() method of this interface accepts elements and adds to the Set object, if the addition is successful it returns true, if you try to add an existing element using this method, the addition operations fails returning false. Problem Statement Given a file which contains duplicate lines, write a program in Java to read the file, remove duplicate lines, and write the unique lines to a new file. Input Hello how are you Hello how are you welcome to Tutorialspoint Output Hello how are you welcome to Tutorialspoint ... Read More

Difference Between Data Analytics and Predictive Analytics

Shirjeel Yunus
Updated on 08-Jul-2024 11:57:11

41 Views

Data analytics is a process which is used to reach the conclusion of the given information. This process is done by filtering the raw data. Predictive analytics is a process in which predictions are made about the results with the help of the current information. In this article, we will discuss the difference between Data and Predictive Analytics. Data Analytics Data analytics is a process in which the raw data is analyzed and conclusions are drawn accordingly. A systemic computational process is needed along with cleaning, aggregation, visualization, and interrogation of the data. The output of the data analytics is ... Read More

Java program to check if a string is a valid number

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

2K+ 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() and Float.parseFloat() methods, respectively. Problem Statement Given a string that may contain an integer or a float value, write a Java program to check whether it is valid number or not. Input "100" //string value Output 100 // ... Read More

Java Connection setTransactionIsolation() method with example

Arushi
Updated on 05-Jul-2024 17:40:49

2K+ Views

In a database system, where more than one transaction is being executed simultaneously and in parallel, the property of isolation states that all the transactions will be carried out and executed as if it is the only transaction in the system. No transaction will affect the existence of any other transaction. Transaction Isolation Levels in Java Connection JDBC (Java Database Connectivity) provides support 5 transaction isolation levels through Connection interface. TRANSACTION_NONE: It is represented by integer value 0 does not support transactions. TRANSACTION_READ_COMMITTED: It is represented by integer value 2 supports ... Read More

Java Program to Check if two strings are anagram

AmitDiwan
Updated on 05-Jul-2024 16:17:32

2K+ Views

An anagram is a word or phrase formed by rearranging the letters of two or more words. Hence, the logic to check whether two given strings are anagram or not is as follows: Suppose there are two strings, if both strings contain the same set of letters along with the same number of letters regardless of their order, then we can say that both strings are anagram otherwise not. Now, let's understand how we can implement this logic in our Java programs to find if two strings are anagram or not. Problem Statement Before jumping to the Java programs to ... Read More

How to specify the HTML content of the page to show in the <iframe> in HTML?

Nikhilesh Aleti
Updated on 05-Jul-2024 14:32:46

3K+ Views

In this article, we need to display the HTML content of the page in an iframe; A browser window divided as a separate page. We can achieve this task using the tag and it’s srcdoc attribute. HTML tag The tag in HTML specifies an inline frame. This inline frame is used to embed another document within the current HTML document. This tag is supported by every browser such as Google Chrome, Microsoft edge/ internet explorer, Firefox, safari, and opera, etc. The “srcdoc” attribute of the tag is used to specify the HTML content of the page ... Read More

Difference between Frameworks and Programming Languages

Shirjeel Yunus
Updated on 05-Jul-2024 11:15:36

19 Views

Programming languages are used to write code to develop websites and applications. Framework is a platform on which different programming languages can work. Programming languages depend on syntax while frameworks deal with architecture. In this article, we will talk about the difference between Frameworks and Programming Languages. Programming Languages Software developers use different kinds of programming languages to develop an application. They have to use the syntax of a programming language to give instructions. These instructions let the computer know how to execute a code. The processor converts the code into machine language which is understood by computers. The output ... Read More

Java Program to Find Area of circle Using Method Overloading

Shiva Keerthi
Updated on 04-Jul-2024 17:49:37

1K+ Views

We can calculate the area of the circle in Java using Method Overloading. “Method Overloading” is a feature in Java that allows one to write more than one method in the same class using the same method name. It will enable us to declare more than one method with the same names but with different signatures i.e., the number of parameters in the method may be different or the datatype of parameters may be different. Now, let us achieve Method Overloading in Java by considering the “area of a circle” as an example. Before moving to an example, now ... Read More

1 2 3 4 5 ... 10872 Next
Advertisements