Samual Sam has Published 2492 Articles

Iterate through Quartet class in JavaTuples

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

96 Views

You can also iterate through Quartet class like Arrays using a loop.Let us first see what we need to work with JavaTuples. To work with Quartet class in JavaTuples, you need to import the following package −import org.javatuples.Quartet;Note − Steps to download and run JavaTuples program. If you are using ... Read More

LocalDate lengthOfYear() method in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

30 Views

The length of the year in a particular LocalDate is obtained using the method lengthOfYear() in the LocalDate class in Java. This method requires no parameters and it returns the length of the year in a particular LocalDate i.e. 365 or 366 for a leap year.A program that demonstrates this ... Read More

LocalDateTime getDayOfMonth() method in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

230 Views

The day of the month for a particular LocalDateTime can be obtained using the getDayOfMonth() method in the LocalDateTime class in Java. This method requires no parameters and it returns the day of the month which can be in the range of 1 to 31.A program that demonstrates this is ... Read More

C++ program to append content of one text file to another

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

1K+ Views

This is a C++ program to append the content of one text file to another.Inputa.txt file contains “Tutorials” a1.txt file contains “point”OutputTutorialspointAlgorithmBegin    Define a fstream class object as fin.    Open a input file a.txt with input file stream class object fin.    Open a output file a1.txt with ... Read More

How can we copy one array from another in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

301 Views

Let us first create a string array −String[] arr = new String[] { "P", "Q", "R", "S", "T"};Now, calculate the length of the above array and create a new array with the same length −int len = arr.length; String[] arr2 = new String[len];Let us copy one array from another −System.arraycopy(arr, ... Read More

What is a Quintet class in Java Tuples?

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

72 Views

A Quintet class is a Tuple of five elements. It is part of the JavaTuples library.The following is the declaration −public final class Quintet extends Tuple implements IValue0, IValue0, IValue0, IValue0, IValue0Let us first see what we need to work with JavaTuples. To work with Quintet class in JavaTuples, you ... Read More

What are JSP declarations? In how many ways we can write JSP declarations?

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

159 Views

A declaration declares one or more variables or methods that you can use in Java code later in the JSP file. You must declare the variable or method before you use it in the JSP file.Following is the syntax for JSP Declarations −You can write the XML equivalent of the ... Read More

How to format currencies in JSP?

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

1K+ Views

The tag is used to format numbers, percentages, and currencies.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultValueNumeric value to displayYesNonetypeNUMBER, CURRENCY, or PERCENTNoNumberpatternSpecify a custom formatting pattern for the output.NoNonecurrencyCodeCurrency code (for type = "currency")NoFrom the default localecurrencySymbolCurrency symbol (for type = "currency")NoFrom the default localegroupingUsedWhether to group numbers ... Read More

LocalDateTime withYear() method in Java

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

98 Views

An immutable copy of a LocalDateTime with the year altered as required is done using the method withYear() in the LocalDateTime class in Java. This method requires a single parameter i.e. the year that is to be set in the LocalDateTime and it returns the LocalDateTime with the year altered ... Read More

Java Program to get maximum value with Comparator

Samual Sam

Samual Sam

Updated on 30-Jul-2019 22:30:25

407 Views

First, declare an integer array and add some elements −Integer arr[] = { 40, 20, 30, 10, 90, 60, 700 };Now, convert the above array to List −List list = Arrays.asList(arr);Now, use Comparator and the reverseOrder() method. Using min() will eventually give you the minimum value, but with reverseOrder(), it ... Read More

Advertisements