Samual Sam has Published 2310 Articles

What is a Unit class in JavaTuples?

Samual Sam

Samual Sam

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

405 Views

A Unit class is a Tuple of one element. It is in the JavaTuples library.The following is the declaration −public final class Unit extends Tuple implements IValue0Let us first see what we need to work with JavaTuples. To work with Unit class in JavaTuples, you need to import the following ... Read More

LocalDate minusWeeks() Method in Java

Samual Sam

Samual Sam

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

157 Views

An immutable copy of the LocalDate where the weeks are subtracted from it can be obtained using the minusWeeks() method in the LocalDate class in Java. This method requires a single parameter i.e. the number of weeks to be subtracted and it returns the instant with the subtracted weeks.A program ... Read More

Why can't we use column name “desc” in MySQL?

Samual Sam

Samual Sam

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

1K+ Views

The desc is a MySQL reserved word, therefore you cannot use it. But, if you still want to set the column name as ‘desc’, you need to use backticks. The backtick notation is (` `).To understand the above concept, let us create a table. The query to create a table is ... Read More

How to print result of a java expression in JSP?

Samual Sam

Samual Sam

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

3K+ Views

The tag displays the result of an expression. This is almost similar to the way works. The difference here is that tag lets you use the simpler "." notation to access properties. For example, to access customer.address.street, use the tag  .The tag can automatically escape XML ... Read More

How to select all rows from a table except the last one in MySQL?

Samual Sam

Samual Sam

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

2K+ Views

You need to use != operator along with subquery. The syntax is as follows −select *from yourTableName where yourIdColumnName != (select max(yourIdColumnName) from yourTableName );To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table AllRecordsExceptLastOne    -> ( ... Read More

Period ofDays() method in Java

Samual Sam

Samual Sam

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

328 Views

The Period can be obtained with the given number of days using the ofDays() method in the Period class in Java. This method requires a single parameter i.e. the number of days and it returns the Period object with the given number of days.A program that demonstrates this is given ... Read More

Count boolean field values within a single MySQL query?

Samual Sam

Samual Sam

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

2K+ Views

To count boolean field values within a single query, you can use CASE statement. Let us create a demo table for our example −mysql> create table countBooleanFieldDemo    -> (    -> StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> StudentFirstName varchar(20),    -> isPassed tinyint(1)    -> ); ... Read More

Insert an element to List using ListIterator in Java

Samual Sam

Samual Sam

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

302 Views

Let us first create an ArrayList −ArrayList < Integer > arrList = new ArrayList < Integer > (); arrList.add(100); arrList.add(200); arrList.add(300); arrList.add(400); arrList.add(500);Now, create a ListIterator from the above ArrayList and insert more elements −ListIterator < Integer > iterator = arrList.listIterator(); iterator.add(1000); iterator.add(2000); iterator.add(3000);Example Live Demoimport java.util.ArrayList; import java.util.ListIterator; public class ... Read More

How to remove a java variable from current scope in JSP?

Samual Sam

Samual Sam

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

499 Views

The tag removes a variable from either a specified scope or the first scope where the variable is found (if no scope is specified). This action is not particularly helpful, but it can aid in ensuring that a JSP cleans up any scoped resources it is responsible for.AttributeThe ... Read More

Period ofYears() method in Java

Samual Sam

Samual Sam

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

203 Views

The Period can be obtained with the given number of years using the ofYears() method in the Period class in Java. This method requires a single parameter i.e. the number of years and it returns the Period object with the given number of years.A program that demonstrates this is given ... Read More

Advertisements