Arushi has Published 157 Articles

Java ResultSet getType() method with example

Arushi

Arushi

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

666 Views

The java.sql.ResultSet interface represents such tabular data returned by the SQL statements.i.e. the ResultSet object holds the tabular data returned by the methods that execute the statements which quires the database (executeQuery() method of the Statement interface in general).The type of the ResultSet object determines the type of the result ... Read More

Java ResultSet getMetaData() method with example

Arushi

Arushi

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

5K+ Views

When we execute certain SQL queries (SELECT query in general) they return tabular data.The java.sql.ResultSet interface represents such tabular data returned by the SQL statements.i.e. the ResultSet object holds the tabular data returned by the methods that execute the statements which quires the database (executeQuery() method of the Statement interface in ... Read More

Static import the Math Class Methods in Java

Arushi

Arushi

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

13K+ Views

Static import means that the fields and methods in a class can be used in the code without specifying their class if they are defined as public static.The Math class method sqrt() in the package java.lang is static imported.A program that demonstrates this is given as follows:Example Live Demoimport static java.lang.Math.sqrt; ... Read More

Get Hash Code for Integer in Java

Arushi

Arushi

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

2K+ Views

The HashCode for an Integer can be obtained using the hashCode() method in Java. This method does not accept any parameters and it returns a hash code value of the Integer object.A program that demonstrates the hashCode() method in Java is given as follows:Example Live Demoimport java.lang.*; public class Demo { ... Read More

Minimum and Maximum Priority Threads in Java

Arushi

Arushi

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

3K+ Views

The thread priority determines when the processor is provided to the thread as well as other resources. It can be changed using the method setPriority() of class Thread.There are three static variables for thread priority in Java i.e. MIN_PRIORITY, MAX_PRIORITY and NORM_PRIORITY. The values of these variables are 1, 10 ... Read More

Is null a literal in Java?

Arushi

Arushi

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

646 Views

The null in Java is a literal of the null type. It cannot be cast to a primitive type such as int. float etc. but can be cast to a reference type. Also, null does not have the value 0 necessarily.A program that demonstrates null in Java is given as ... Read More

Use the ? quantifier in Java Regular Expressions

Arushi

Arushi

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

120 Views

In general, the ? quantifier represents 0 or 1 occurrences of the specified pattern. For example - X? means 0 or 1 occurrences of X.The regex "t.+?m" is used to find the match in the string "tom and tim are best friends" using the ? quantifier.A program that demonstrates this ... Read More

Validate Email address in Java

Arushi

Arushi

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

3K+ Views

The Email address can be validated using the java.util.regex.Pattern.matches() method. This method matches the regular expression for the E-mail and the given input Email and returns true if they match and false otherwise.A program that demonstrates this is given as follows:Example Live Demopublic class Demo {    static boolean isValid(String email) ... Read More

Split a string around a particular match in Java

Arushi

Arushi

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

255 Views

The specified string can be split around a particular match for a regex using the String.split() method. This method has a single parameter i.e. regex and it returns the string array obtained by splitting the input string around a particular match for the regex.A program that demonstrates splitting a string ... Read More

Class declaration with a method that has a parameter in Java

Arushi

Arushi

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

155 Views

A class declaration can contain a method that has a parameter in Java. A program that demonstrates this is given as follows:Example Live Democlass Message {    public void messagePrint(String msg) {       System.out.println("The message is: " + msg);    } } public class Demo { ... Read More

Advertisements