Karthikeya Boyini has Published 2193 Articles

Java Program to sort a subset of array elements

karthikeya Boyini

karthikeya Boyini

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

339 Views

Let us first create a string array −String[] strArr = new String[] { "r", "p", "v", "y", "s", "q" };Now, use Arrays.sort() to get the subset. Use the following to sort only from the index range 2 to 6.Arrays.sort(strArr, 2, 6);Example Live Demoimport java.util.Arrays; public class Demo {    public static ... Read More

How to format percentages in JSP?

karthikeya Boyini

karthikeya Boyini

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

630 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

What is a scriptlet in JSP and what is its syntax?

karthikeya Boyini

karthikeya Boyini

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

2K+ Views

A scriptlet can contain any number of JAVA language statements, variable or method declarations, or expressions that are valid in the page scripting language.Following is the syntax of Scriptlet −You can write the XML equivalent of the above syntax as follows − code fragment Any text, HTML ... Read More

LocalDateTime getDayOfWeek() method in Java

karthikeya Boyini

karthikeya Boyini

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

156 Views

The day of the week for a particular LocalDateTime can be obtained using the getDayOfWeek() method in the LocalDateTime class in Java. This method requires no parameters and it returns the day of the week.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; public class Demo { ... Read More

Java Program to convert array to String for one dimensional and multi-dimensional arrays

karthikeya Boyini

karthikeya Boyini

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

356 Views

For converting array to 1D and 2D arrays, let us first create a one-dimensional and two-dimensional array −One-DimensionalString str[] = {"p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"};Two-Dimensionaldoubled [][]= {    {1.2, 1.3, 2.1, 4.1},    {1.5, 2.3},    {2.5, 4.4},    {3.8},    {4.9},    {3.2, ... Read More

Get a value from Quartet class in JavaTuples

karthikeya Boyini

karthikeya Boyini

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

175 Views

The getValueX() method is used to get a value from Quartet 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 Quartet class in JavaTuples, you need to import the following package −import org.javatuples.Quartet;Note − Steps ... Read More

LocalDateTime getMonthValue() method in Java

karthikeya Boyini

karthikeya Boyini

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

124 Views

The month of the year is obtained using getMonthValue() method in the LocalDateTime 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

How to declare an object of a class using JSP declarations?

karthikeya Boyini

karthikeya Boyini

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

1K+ 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 parse number in JSP?

karthikeya Boyini

karthikeya Boyini

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

901 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

LocalDateTime format() method in Java

karthikeya Boyini

karthikeya Boyini

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

332 Views

The LocalDateTime can be formatted with the specified formatter using the format() method in the LocalDateTime class in Java. This method requires a single parameter i.e. the LocalDateTime object to be formatted and it returns the formatted LocalDateTime with the specified formatter.A program that demonstrates this is given as follows ... Read More

Advertisements