Samual Sam has Published 2492 Articles

Java Program to shift array elements to the right

Samual Sam

Samual Sam

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

324 Views

Let us first create an int array −int[] arr = { 10, 20, 30, 40, 50, 60, 70, 80, 90 };Now, shift array elements to the right with arraycopy() and placing the elements correctly so that it gets shifted to the right −System.arraycopy(arr, 0, arr, 1, arr.length - 1);Example Live Demoimport ... Read More

JavaTuples setAt1 () method for Quartet class

Samual Sam

Samual Sam

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

55 Views

The setAt1() method is used to set the Quartet value in JavaTuples and a copy with new value at the specified index i.e. index 1 here.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 ... Read More

I want to use <% literal in JSP page. But it is throwing error. How to escape this syntax in JSP?

Samual Sam

Samual Sam

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

499 Views

You can escape it using backslash character. Replace

tellp() in file handling with C++

Samual Sam

Samual Sam

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

1K+ Views

In C++ file handling, the tellp() function is used with output streams, and returns the current put position of the pointer in the stream. It returns an integer data type, representing the current position of the stream pointer.tellp() method takes no parameter. It is written as: pos_type tellp();AlgorithmBegin.    Create ... Read More

Java Program to generate random elements from a given array

Samual Sam

Samual Sam

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

383 Views

Let’s say the following is our array −Integer[] arr = {2, 4, 6, 8, 10, 12, 14, 16, 18, 20};Now, we can convert it to a list before shuffling it −Listlist = Arrays.asList(arr); Collections.shuffle(list);The above shuffling generates random elements. Display them like this −for (Integer res: list) {    System.out.print(res ... Read More

How to use resource bundle in JSP?

Samual Sam

Samual Sam

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

1K+ Views

The tag will make the specified bundle available to all tags that occur between the bounding and tags. With this, you need not specify the resource bundle for each of your tags.For example, the following two blocks will produce the same output − ... Read More

Search a value in JavaTuples Quintet class

Samual Sam

Samual Sam

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

63 Views

Use the contains() method to search a value in the Quintet class in JavaTuples.Let us first see what we need to work with JavaTuples. To work with Quintet class in JavaTuples, you need to import the following package −import org.javatuples.Quintet;Note − Steps to download and run JavaTuples program. If you ... Read More

What are JSP Directives?

Samual Sam

Samual Sam

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

198 Views

A JSP directive affects the overall structure of the servlet class. It usually has the following form −There are three types of directive tag −S.No.Directive & Description1Defines page-dependent attributes, such as scripting language, error page, and buffering requirements.2Includes a file during the translation phase.3Declares a tag library, containing custom actions, ... Read More

Java Program to convert java.util.Date to LocalDate

Samual Sam

Samual Sam

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

169 Views

At first set the date with java.util.Date −java.util.Date date = new Date();Now, convert the date to LocalDate −Instant instant = Instant.ofEpochMilli(date.getTime()); System.out.println("LocalDate = "+LocalDateTime.ofInstant(instant, ZoneId.systemDefault()).toLocalDate());Example Live Demoimport java.time.Instant; import java.time.LocalDateTime; import java.time.ZoneId; import java.util.Date; public class Demo {    public static void main(String[] args) {       java.util.Date date = ... Read More

How to hide the status bar in a iOS App using Swift?

Samual Sam

Samual Sam

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

2K+ Views

Sometimes in our application, we need to hide the status bar, navigation bar, and other things and only show the content we want to display. In this article, we’ll see how to hide the status bar in our application. To hide status bar in our iOS application using swift language ... Read More

Advertisements