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 has no methods or if a primitive type, array class or void is represented in the Class object.A program that demonstrates this is given as follows −Example Live Demoimport java.lang.reflect.Method; class ClassA { private String name = "John"; public String returnName() { return name; } ... Read More
Chatbots − Little bots can answer questions and give information based on queries in natural written language. It is also possible to place orders with them. Many companies already use chatbots. Among them are Uber, Sephora, KLM, and Whole Foods.Microblogging − Short message postings from a social media account. Facebook statuses and Twitter posts are two examples.Tweeps − Twitter + People = Tweople. Twitterati is also used for Twitter users.Meme − A means of taking viral concepts and making them everyday lingo.User-Generated-Content (UGC) − An article describes UGC as being Latin for "crap" which is, quite frankly, well-put. UGC is ... Read More
The JSON.parse() function accepts a JSON string, and constructs an object based on the given text and, returns it.SyntaxIts Syntax is as followsJson.parse();Example Live Demo JavaScript Example var jsonSample = '{"Tutorial": "Java", "Version":8 }'; jsonObj = JSON.parse(jsonSample); document.write("Tutorial Name: " + jsonObj.Tutorial); document.write(""); document.write("Tutorial Version: " + jsonObj.Version); OutputTutorial Name: Java Tutorial Version: 8
The stringify() function of a JSON object accepts a JSON string, and constructs an object based on the given text and, returns it.SyntaxIts Syntax is as followsJson.stringify();Example Live Demo JavaScript Example var jsonSample = '{Tutorial: Java, Version:8}'; jsonObj = JSON.stringify(jsonSample); document.write(jsonObj); Output"{Tutorial: Java, Version:8}"
A number is divisible by 11 if the difference between the sum of its alternative digits is divisible by 11.i.e. if (sum of odd digits) – ( sum of even digits) is 0 or divisible by 11 then the given number is divisible by 11.Programimport java.util.Scanner; public class DivisibleBy11 { public static void main(String args[]) { Scanner sc = new Scanner(System.in); System.out.println("Enter a number :"); String num = sc.nextLine(); int digitSumEve = 0; int digitSumOdd = 0; for(int i = 0; i
The current method name that contains the execution point that is represented by the current stack trace element is provided by the java.lang.StackTraceElement.getMethodName() method.A program that demonstrates this is given as follows −Example Live Demopublic class Demo { public static void main(String args[]) { System.out.println ("The method name is: " + new Exception().getStackTrace()[0].getMethodName()); } }OutputThe method name is: mainNow let us understand the above program.The method getMethodName() is used to obtain the current method name that contains the execution point that is represented by the current stack trace element. This is printed using ... Read More
The set() function of Map object adds or updates elements (key-value pairs) to a Map object.SyntaxIts Syntax is as followsmapVar.set()Example Live Demo JavaScript Example var mapVar = new Map(); mapVar.set('1', 'Java'); mapVar.set('2', 'JavaFX'); mapVar.set('3', 'HBase'); mapVar.set('4', 'Neo4j'); document.write(mapVar.has('3')); Outputtrue
If the sum of the digits of a number is divisible by 9, then the number is divisible by 9.Some examples of numbers divisible by 9 are as follows. The number 51984 is divisible by 9 because the sum of its digits (5+ 1 + 9 + 8 + 4 = 27) is divisible by 9.The number 91403 is not divisible by 9 because the sum of its digits (9 + 1 + 4 + 0 + 3 = 17) is not divisible by 9.Programimport java.util.Scanner; public class DivisibleBy9 { public static void main(String args[]) { Scanner sc = new Scanner(System.in); System.out.println("Enter a number :"); String num = sc.nextLine(); int digitSum = 0; for(int i = 0; i
As of the first quarter of 2018, Facebook had 2.19 billion monthly active users. In the third quarter of 2012, the number of active Facebook users had surpassed one billion, making it the first social network ever to do so. Active users are those, which have logged in to Facebook during the last 30 days.The number of mobile Facebook users across the globe in 2018 is 1.34 Billion.Facebook's total quarterly revenue as of the first quarter of 2018 has amounted to 11.96 billion U.S. dollars, the majority of which were generated through advertising.24 Aug 2015, a billion people used Facebook ... Read More
ProgramFollowing is the example to calculate the GCD of the numbers of an array.Live Demopublic class GCDOfArrayofNumbers{ public static int gcd(int a,int b){ int res = 0; while (b > 0){ int temp = b; b = a % b; a = temp; res = a; } return res; } public static void main(String arg[]){ int[] myArray = {3, 6, 8}; int result = gcd(myArray[0],myArray[1]); for(int i = 2; i < myArray.length; i++){ result = gcd(result, myArray[i]); } System.out.println("Gcd of n numbers is: "+result); } }OutputGCD of n numbers is: 1
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP