JavaScript

Add Euler Mascheroni constant to each element of an array in java

The Euler-Mascheroni constant is denoted by gamma, it is a mathematical constant approximately equal to 0.57721.It appears frequently in various areas of mathematics and it arises naturally in the study of harmonic series and certain integrals in calculus . How to add Euler-Mascheroni constant to each element of an array in java Here are the …

Add Euler Mascheroni constant to each element of an array in java Read More »

How to write a JavaScript using eval() function

The eval() method in Java Script evaluates  or  executes its argument. If  the argument is an expression, it evaluates the expression. If  it’s one or more JavaScript statements, eval() executes the statements. This function was used to evaluate a string as JavaScript code, but it is now considered deprecated because it can introduce security vulnerabilities …

How to write a JavaScript using eval() function Read More »

can we have try block without catch or finally block in java

‘try’ block without either a ‘catch’ block or a ‘finally’ block is not allowed in java.The main purpose of a ‘try’ block is to wrap code that might throw an exception, and it must be followed by either a ‘catch’ block to handle exceptions ‘finally’ block to execute code after the ‘try’ block regardless of …

can we have try block without catch or finally block in java Read More »

How to create a list using List.of() method in java

Creating a List using ‘List.of()’ : This method was introduced in java 9 as part of the java collection framework enhancements. The “List.of()’ method can be used to create a list with up to 10 elements. Steps to how to create a list using List.of() method in java Step-1: Import the List class: import java.util.List; …

How to create a list using List.of() method in java Read More »

Scroll to Top