Karthikeya Boyini has Published 2193 Articles

Java Program to create an array with randomly shuffled numbers in a given range

karthikeya Boyini

karthikeya Boyini

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

150 Views

For randomly shuffled numbers, let us create an integer list and add some numbers −List < Integer > list = new ArrayList < Integer > (); list.add(10); list.add(50); list.add(100); list.add(150); list.add(200);Now, shuffle the elements for random values −Collections.shuffle(list);Create an int array with the same number of elements in the above ... Read More

How to print a date using JSP Expression?

karthikeya Boyini

karthikeya Boyini

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

382 Views

Following example shows a JSP Expression printing date on the browser −           A Comment Test     Today's date: The above code will generate the following result −Today's date: 11-Sep-2010 21:24:25

LocalTime minusMinutes() method in Java

karthikeya Boyini

karthikeya Boyini

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

155 Views

An immutable copy of a LocalTime object where some minutes are subtracted from it can be obtained using the minusMinutes() method in the LocalTime class in Java. This method requires a single parameter i.e. the number of minutes to be subtracted and it returns the LocalTime object with the subtracted ... Read More

How to parse currencies in JSP?

karthikeya Boyini

karthikeya Boyini

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

240 Views

The tag is used to parse numbers, percentages, and currencies.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultValueNumeric value to read (parse)NoBodytypeNUMBER, CURRENCY, or PERCENTNonumberparseLocaleLocale to use when parsing the numberNoDefault localeintegerOnlyWhether to parse to an integer (true) or floating-point number (false)NofalsepatternCustom parsing patternNoNonetimeZoneTime zone of the displayed dateNoDefault time ... Read More

Get a value from Triplet class in JavaTuples

karthikeya Boyini

karthikeya Boyini

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

264 Views

The getValueX() method is used to get a value from the Triplet Tuple class in Java at a particular index. For example, getValue0().Let us first see what we need to work with JavaTuples. To work with Triplet class in JavaTuples, you need to import the following package −import org.javatuples.Triplet;Note − ... Read More

LocalDate lengthOfMonth() method in Java

karthikeya Boyini

karthikeya Boyini

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

128 Views

The length of the month in a particular LocalDate is obtained using the method lengthOfMonth() in the LocalDate class in Java. This method requires no parameters and it returns the length of the month in a particular LocalDate i.e. 28, 29, 30 or 31.A program that demonstrates this is given ... Read More

How to shuffle an array in Java?

karthikeya Boyini

karthikeya Boyini

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

3K+ Views

Declare a string array and add elements in the form of letters −String[] letters = { "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };Convert the above array to list −Listlist = Arrays.asList(letters);Now, create a shuffled array using the Random class object and generate the random letters ... Read More

What are JSP comments?

karthikeya Boyini

karthikeya Boyini

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

7K+ Views

JSP comment marks text or statements that the JSP container should ignore. A JSP comment is useful when you want to hide or "comment out", a part of your JSP page.Following is the syntax of the JSP comments −Following example shows the JSP Comments −           ... Read More

How to parse date in JSP?

karthikeya Boyini

karthikeya Boyini

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

1K+ Views

The tag is used to parse dates.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultValueDate value to read (parse)NoBodytypeDATE, TIME, or BOTHNodatedateStyleFULL, LONG, MEDIUM, SHORT, or DEFAULTNoDefaulttimeStyleFULL, LONG, MEDIUM, SHORT, or DEFAULTNoDefaultparseLocaleLocale to use when parsing the dateNoDefault localepatternCustom parsing patternNoNonetimeZoneTime zone of the parsed dateNoDefault time zonevarName of the ... Read More

LocalDate getMonthValue() method in Java

karthikeya Boyini

karthikeya Boyini

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

126 Views

The month of the year is obtained using getMonthValue() method in the LocalDate class in Java. This method requires no parameter and it returns the month of the year which may be in the range of 1 to 12.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; ... Read More

Advertisements