Anvi Jain has Published 634 Articles

Prove that the interface for a primitive type is an empty array in Java

Anvi Jain

Anvi Jain

Updated on 25-Jun-2020 12:25:30

80 Views

The getInterfaces() method is used to prove that the interface for a primitive type is an empty array. A program that demonstrates this is given as follows −Example Live Demopackage Test; import java.util.*; public class Demo {    public static void main(String[] args) {       Class c = int.class; ... Read More

How to call Private Constructor in Java

Anvi Jain

Anvi Jain

Updated on 25-Jun-2020 12:23:27

872 Views

The method java.lang.Class.getDeclaredConstructor() can be used to obtain the constructor object for the private constructor of the class. The parameter for this method is a Class object array that contains the formal parameter types of the constructor.A program that demonstrates this is given as follows −Example Live Demopackage Test; import java.lang.reflect.*; ... Read More

Get the name of a primitive type in Java

Anvi Jain

Anvi Jain

Updated on 25-Jun-2020 12:08:55

1K+ Views

The getName() method is used to get the names of the entities such as primitive type, interface, class, array class, void etc. that represented by the class objects. These names are returned in the form of a string.A program that gets the name of a primitive type using getName() method ... Read More

Java Program to fill elements in an int array

Anvi Jain

Anvi Jain

Updated on 25-Jun-2020 12:06:00

1K+ Views

Elements can be filled in an int array using the java.util.Arrays.fill() method. This method assigns the required int value to the int array in Java. The two parameters required are the array name and the value that is to be stored in the array elements.A program that demonstrates this is ... Read More

Call methods of an object using reflection in Java

Anvi Jain

Anvi Jain

Updated on 25-Jun-2020 12:05:30

590 Views

The methods of an object can be called using the java.lang.Class.getDeclaredMethods() method. This method returns an array that contains all the Method objects with public, private, protected and default access. However, the inherited methods are not included.Also, the getDeclaredMethods() method returns a zero length array if the class or interface ... Read More

Typecasting NULL to 0 in MySQL

Anvi Jain

Anvi Jain

Updated on 25-Jun-2020 11:36:05

363 Views

You can typecast NULL to 0 with the help of IFNULL() function. The syntax is as follows −select ifnull(yourColumnName) as anyVariableName from yourTableName;To understand the above concept, let us first create a table −mysql> create table TypecastDemo    −> (       −> AccountNumber int    −> ); Query ... Read More

Get the week number in MySQL for day of week?

Anvi Jain

Anvi Jain

Updated on 25-Jun-2020 11:25:15

151 Views

MySQL DAYOFWEEK() function returns 1 for Sunday, 2 for Monday and so on for day of week. Let us see an example by first creating a table −mysql> create table DayOfWeekDemo −> (    −> Issuedate datetime −> ); Query OK, 0 rows affected (0.52 sec)Inserting date in the table ... Read More

How add unique key to existing table (with non-unique rows)?

Anvi Jain

Anvi Jain

Updated on 25-Jun-2020 11:23:55

617 Views

You can add unique key to existing table with the help of alter command. The syntax is as follows −ALTER TABLE yourTableName ADD CONSTRAINT yourConstraintName UNIQUE(yourColumnName1, yourColumnName2, ............N);To understand the above concept, let us create a table with some columns. The query to create a table −mysql> create table MovieCollectionDemo ... Read More

HTML5 appcache with Safari causing cross-site css to not load correctly

Anvi Jain

Anvi Jain

Updated on 25-Jun-2020 07:53:42

87 Views

Appcaches are used by the web browser to specify what files exist on your site that is relevant to the particular page the browser is visiting.Safari follows the AppCache standard more strictly and sees a request for a web address that is not in the AppCache.To avoid the requests to ... Read More

Convert coordinates to a place name with HTML5

Anvi Jain

Anvi Jain

Updated on 25-Jun-2020 07:22:53

179 Views

For this, use Google Maps API to perform reverse geocoding.Geocoding refers to translating a human-readable address into a location on a map.The process of doing the converse, translating a location on the map into a human-readable address, is known as reverse geocoding.ExampleLet us see an example to set latitude and longitude ... Read More

Previous 1 ... 5 6 7 8 9 ... 64 Next
Advertisements