Karthikeya Boyini has Published 2383 Articles

Clock systemUTC() Method in Java

karthikeya Boyini

karthikeya Boyini

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

186 Views

The current instance of the clock with the UTC time zone can be obtained using the method systemUTC() in the Clock Class in Java. This method requires no parameters and it returns the current instance of the clock with the UTC time zone.A program that demonstrates this is given as ... Read More

Create Unit Tuple in Java using with() method

karthikeya Boyini

karthikeya Boyini

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

72 Views

Let us create Unit Tuple in Java using with() method.Let us first see what we need to work with JavaTuples. To work with the Unit class in JavaTuples, you need to import the following package −import org.javatuples.Unit;Note − Steps to download and run JavaTuples program If you are using Eclipse ... Read More

How to read cookies with JSP?

karthikeya Boyini

karthikeya Boyini

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

1K+ Views

To read cookies, you need to create an array of javax.servlet.http.Cookie objects by calling the getCookies( ) method of HttpServletRequest. Then cycle through the array, and use getName() and getValue() methods to access each cookie and associated value.Let us now read cookies that were set in the previous example −Example Live ... Read More

Java Program to shuffle an array using list

karthikeya Boyini

karthikeya Boyini

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

129 Views

Let us first create a string array and convert it to a list. After that, the shuffle would be performed.Following is the string array −String str[] = {"A", "B", "C", "D", "E"};Convert the string array to list −Listlist = Arrays.asList(str);Now shuffle the array −Collections.shuffle(list);Exampleimport java.util.Arrays; import java.util.Collections; import java.util.List; public ... Read More

Create Pair Tuple using with() method in Java

karthikeya Boyini

karthikeya Boyini

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

87 Views

You can also create a Pair Tule in Java using the with() method.Let us first see what we need to work with JavaTuples. To work with Pair class in JavaTuples, you need to import the following package −import org.javatuples.Pair;Note − Steps to download and run JavaTuples program If you are ... Read More

As HTTP is a stateless then how to maintain the session between web browser and web server?

karthikeya Boyini

karthikeya Boyini

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

4K+ Views

HTTP is a "stateless" protocol which means each time a client retrieves a Webpage, the client opens a separate connection to the Web server and the server automatically does not keep any record of previous client request.Maintaining Session Between Web Client And ServerLet us now discuss a few options to ... Read More

Difference between find() and findOne() methods in MongoDB?

karthikeya Boyini

karthikeya Boyini

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

4K+ Views

The findOne() returns first document if query matches otherwise returns null. The find() method does not return null, it returns a cursor.Let us implement the concept of find() and findOne() and create a collection with documents −> db.createCollection('emptyCollection'); { "ok" : 1 }Let us count how many documents are in ... Read More

Insert default into not null column if value is null in MySQL?

karthikeya Boyini

karthikeya Boyini

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

1K+ Views

You can use IFNULL() property or simple IF() with IS NULL property. The syntax is as follows −INSERT INTO yourTableName(yourColumnName1, yourColumnName2) VALUES('yourValue’', IF(yourColumnName1 IS NULL, DEFAULT(yourColumnName2), 'yourMessage'));To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table Post ... Read More

Java 8 Clock millis() Method

karthikeya Boyini

karthikeya Boyini

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

257 Views

The current instance of the clock in milliseconds can be obtained using the method millis() in the Clock Class in Java. This method requires no parameters and it returns the current instant of the clock in milliseconds. If the instance cannot be obtained for some reason, then the DateTimeException is ... Read More

Create Pair Tuple from another collection in Java

karthikeya Boyini

karthikeya Boyini

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

130 Views

Use the fromCollection() method to create a Pair Tuple from another collection, for example, List.Let us first see what we need to work with JavaTuples. To work with Pair class in JavaTuples, you need to import the following package −import org.javatuples.Pair;Note − Steps to download and run JavaTuples program If ... Read More

Advertisements