The size property of the Set object returns number representing the number of elements in the current set object.SyntaxIts Syntax is as followsObj.size();Example Live Demo JavaScript Example const setObj = new Set(); setObj.add('Java'); setObj.add('JavaFX'); setObj.add('JavaScript'); setObj.add('HBase'); document.write("Size of the Set object: "+setObj.size); OutputSize of the Set object: 4
The getDeclaringClass() method returns the Class object for the class in which the object was declared. This happens only if the Class of the Class object is a member of another class. Otherwise this method returns null.Also, if a primitive type, array class, void etc. are represented by the Class object, then the getDeclaringClass() method returns null.A program that demonstrates the getDeclaringClass() method is given as follows −Example Live Demopackage Test; import java.lang.reflect.*; public class Demo { public static void main(String[] args) { Method[] m = String.class.getMethods(); for(int i = 0; i < m.length; ... Read More
Third generation mobile phones, or “3G Internet” mobile phones, is a set of standards for wireless mobile communication systems, that promises to deliver quality multimedia services along with high quality voice transmission.Features3G systems comply with the International Mobile Telecommunications-2000 (IMT-2000)specifications by the International Telecommunication Union (ITU).The first 3G services were available in 1998.It provides high speed transmission having data transfer rate more than 0.2Mbps.Global roaming services are available for both voice and data.It offers advanced multimedia access like playing music, viewing videos, television services etc.It provides access to all advanced Internet services, for example surfing webpages with audio and video.It ... Read More
The add() function of the Set object accepts a value and adds/appends it to the current Set object.SyntaxIts Syntax is as followssetObj.add()Example Live Demo JavaScript Example const setObj = new Set(); setObj.add('Java'); setObj.add('JavaFX'); setObj.add('JavaScript'); setObj.add('HBase'); document.write("Contents of the Set:"); document.write(""); for (let item of setObj) { document.write(item); document.write(""); } OutputContents of the Set: Java JavaFX JavaScript HBase
Use the border-radius property to set all the four border-radius properties. You can try to run the following code to implement border-radius property:ExampleLive Demo #rcorner { border-radius: 25px; background: #85C1E9; color: white; padding: 20px; width: 200px; height: 250px; } Rounded corners!
The clear() function of the Set object removes all elements from the current Set object.SyntaxIts Syntax is as followssetObj.clear()Example Live Demo JavaScript Example const setObj = new Set(); setObj.add('Java'); setObj.add('JavaFX'); setObj.add('JavaScript'); setObj.add('HBase'); setObj.clear(); document.write("Contents of the Set:"); for (let item of setObj) { document.write(item); document.write(""); } OutputContents of the Set:
Following is a program to get the result of Euler’s Totient function for all numbers smaller than or equal to n when n is given.Programimport java.util.Scanner; public class EulerTotient { public static int gcd(int a,int b){ int i, hcf = 0; for(i = 1; i
The entries() function of the Set returns an iterator object which holds the contents of the current Set. This iterator object returns a pair of values for each entry just like map (key and value). But here, instead of both key and value it returns the element of the set in the particular position.SyntaxIts Syntax is as followssetObj.entries()Example Live Demo JavaScript Example const setObj = new Set(); setObj.add('Java'); setObj.add('JavaFX'); setObj.add('JavaScript'); setObj.add('HBase'); const entries = setObj.entries(); ... Read More
According to Euler’s criterion a square root of n under modulo p exists if and only if a number num exists such that num%p is equal to n%p.Programimport java.util.Scanner; public class EulersCriterion { public static void main(String args[]) { Scanner sc = new Scanner(System.in); System.out.println("Enter n value :"); int n = sc.nextInt(); System.out.println("Enter p value :"); int p = sc.nextInt(); n = n % p; int flag = 0; for ... Read More
The forEach() function of the Set object accepts the name of a particular function and runs that function for every value in the current set. For Example, if you have written a function to print a value, if you use forEach() function it prints the value of every element in the set.SyntaxIts Syntax is as followssetObj.forEach()Example Live Demo JavaScript Example function sampleFunction(value){ document.writeln(value+", "); } const setObj1 = new Set(); setObj1.add('Java'); setObj1.add('JavaFX'); setObj1.add('JavaScript'); ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP