Tutorialspoint

How to access nested json objects in JavaScript?

vineeth.mariserla
Answered Just Now

Accessing nested json objects is just like accessing nested arrays. Nested objects are the objects that are inside an object literal.In the following example 'vehicles' is a object which is inside a main object called 'person'. Using dot notation the nested objects' property(plane) is accessed.Example-1Live Demo<html> <body> <script> ... Read More

What will happen when we try to override final method of the superclass in Java?

raja ramesh
Answered 1h 2m ago

Any method that is declared final in the superclass cannot be overridden by a subclass. If we try to override the final method of super class we will get an error in Java.Rules for implementing Method OverridingThe method declaration should be the same as that of the method that is to be ... Read More

What is the difference between instanceof() and Array.isArray() methods in JavaScript?

vineeth.mariserla
Answered 2h 13m ago

Array.isArray() method is universal, it can function any where whereas instanceof operator is not universal, it can't work in new environment..syntax-1Array.isArray(array);syntax-2array instance of Array;In the following example, where there is no new environment created, both Array.isArrar() and instanceof have produced same output.ExampleLive Demo<html> <body> <script> var a ... Read More

How to handle the StringIndexOutOfBoundsException (unchecked) in Java?

raja ramesh
Answered 2h 54m ago

The StringIndexOutOfBoundsException is one of the unchecked exceptions in Java. A string is kind of an ensemble of characters. String object has a range of [0, length of the string]. When someone tries to access the characters with limits exceeding the range of actual string value, this exception occurs.Example1Live Demopublic class StringDemo {    public static ... Read More

How to check whether an array is a true array in JavaScript?

vineeth.mariserla
Answered 5h 5m ago

In javascript, arrays are not true arrays. They are javascript objects. So when we try to know their type using typeof() operator the displayed output will be object.Syntaxtypeof(operand);parameters - typeof() operator takes an operand and returns the data type of the operand. In the following example even though variable 'a' is ... Read More

What are the rules need to follow when overriding a method that throws an exception in Java?

raja ramesh
Answered 5h 42m ago

We need to follow some rules when we overriding a method that throws an Exception.When the parent class method doesn’t throw any exceptions, the child class method can’t throw any checked exception, but it may throw any unchecked exceptions.class Parent {    void doSomething() {       // ...    } ... Read More

What is a ClassCastException and when it will be thrown in Java?

raja ramesh
Answered 18h 34m ago

The java.lang.ClassCastException is one of the unchecked exception in Java. It can occur in our program when we tried to convert an object of one class type into an object of another class type.When will be ClassCastException is thrownWhen we try to cast an object of Parent class to its Child class type, this exception ... Read More

How many ways can a property of a JavaScript object be accessed?

vineeth.mariserla
Answered 21h 10m ago

An object property can be accessed in two ways. One is .property and the other is [property].Syntax-1Object.property;Syntax-2Object["property"];For better understanding, lets' look at the following example.In the following example an object called 'person' is defined and its properties were accessed in a dot notation.ExampleLive Demo<html> <body> <script> var ... Read More

How to write a recursive function in Python?

Sri
Sri
Answered 21h 32m ago

A recursive function is a function that calls itself during its execution. This enables the function to repeat itself several times, outputting the result and the end of each iteration. Recursion has something to do with infinity. Following is an example of recursive function to find the factorial of an integer.Factorial of a ... Read More

How to make a class JSON Serializable in Python?

Sri
Sri
Answered 21h 43m ago

Serialisation is the process of transforming objects of complex data types to native data types so that they can then be easily converted to JSON notation. If you have a JSON string, you can convert it into a JSON string by using the json.dumps() method.Python pickle module is used for serialising ... Read More

What is the use of Object.isFrozen() method in JavaScript?

vineeth.mariserla
Answered 21h 48m ago

Object.isFrozen()Object.isFrozen() method is used to find whether an object is frozen or not. An object is frozen if it followed the below criteria1) It should not be extensible.2) Its properties should be non-configurable.3) It shouldn't accept any new properties.SyntaxObject.isFrozen(obj);Parameters - Object.isFrozen() accepts an object as a parameter and scrutinizes whether it is frozen ... Read More

How does Python's super() work with multiple inheritance?

Sri
Sri
Answered 21h 54m ago

Before going to explain super() first we need to know about multiple inheritance concept.Multiple inheritance : Means one child class can inherit multiple parent classes.In the following example Child class inherited attributes methods from the Parent class.Exampleclass Father:    fathername = ""    def father(self):    print(self.fathername) class Mother:   ... Read More

What are the different types of nested classes are defined in Java?

raja ramesh
Answered 22h 4m ago

In Java, it is possible to define a class inside another class, such classes are called Nested classes. We can use the access modifiers like private, public, protected or default for inner classes and default or public access modifiers for outer class.There are two types of nested classes are defined in ... Read More

What does double question mark (??) operator mean in PHP ?

Alok Prasad
Answered 22h 6m ago

PHP 7 has added a new operator double question mark (??) operator. In PHP 7, the double question mark(??) operator known as Null Coalescing Operator.It returns its first operand if it exists and is not NULL; otherwise, it returns its second operand. It evaluates from left to right. Null Coalescing ... Read More

What is the difference between del, remove and pop on lists in python ?

Sri
Sri
Answered 22h 9m ago

It does't matter how many lines of code you write in a program. When you want to remove or delete any elements from the Python list, you have to think about the difference between remove, del and pop in Python List and which one to useremove : remove() removes the first matching value ... Read More

1 2 3 4 5 6 7 ... 1448 Next
Advertisements
Loading...
Unanswered Questions View All

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.