Articles on Trending Technologies

Technical articles with clear explanations and examples

How to decode an encoded string in JavaScript?

vineeth.mariserla
vineeth.mariserla
Updated on 11-Mar-2026 11K+ Views

DecodingIn JavaScript, to decode a string unescape() method is used. This method takes a string, which is encoded by escape() method, and decodes it. The hexadecimal characters in a string will be replaced by the actual characters they represent using unescape() method.Syntaxunescape(string)ExampleIn the following the two exclamation marks have converted to hexadecimal characters using escape() method. Later on those marks were decoded in to their natural characters using unescape() method.     // Special character encoded with escape function    var str = escape("Tutorialspoint!!");    document.write("");    document.write("Encoded : " + str);    // unescape() function    document.write("Decoded : ...

Read More

What is the difference between String, StringBuffer and StringBuilder classes in Java explain briefly?

Narasimha Murthi
Narasimha Murthi
Updated on 11-Mar-2026 730 Views

The String class of the java.lang package represents character strings. All string literals in Java programs, such as "abc", are implemented as instances of this class. Strings are constant, their values cannot be changed after they are created.The StringBuffer and StringBuilder classes are used when there is a necessity to make a lot of modifications to Strings of characters.Unlike Strings, objects of type StringBuffer and String builder can be modified over and over again without leaving behind a lot of new unused objects.The StringBuilder class was introduced as of Java 5 and the main difference between the StringBuffer and StringBuilder ...

Read More

What is an OutOfMemoryError and steps to find the root cause of OOM in Java?

raja
raja
Updated on 11-Mar-2026 2K+ Views

The OutOfMemoryError is thrown by JVM, when JVM does not have enough available memory, to allocate. OutOfMemoryError falls into the Error category in Exception class hierarchy.To generate OutOfMemoryErrorWe will allocate a large chunk of memory, which will exhaust heap memory storage.We will keep on allocating the memory and point will reach, when JVM will not have enough memory to allocate, then OutOfMemoryError will be thrown.Once we will catch the OutOfMemory error, we can log the error.Examplepublic class OutOfMemoryErrorDemo {    public static void main(String[] args) throws Exception {       int dummyArraySize = 15;       System.out.println("Max JVM memory: " + Runtime.getRuntime().maxMemory());   ...

Read More

How can I swap two strings without using a third variable in Java?

Narasimha Murthi
Narasimha Murthi
Updated on 11-Mar-2026 2K+ Views

To swap the contents of two strings (say s1 and s2) without the third.First of all concatenate the given two strings using the concatenation operator “+” and store in s1 (first string).s1 = s1+s2;The substring method of the String class is used to this method has two variants and returns a new string that is a substring of this string. The substring begins with the character at the specified index and extends to the end of this string or up to endIndex – 1, if the second argument is given.Now using the substring() method of the String class store the ...

Read More

Multiple Where clause in C# Linq

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 5K+ Views

Filter collections using Where clause in C#. A single query expression may have multiple where clauses.Firstly, set a collection −IList employee = new List() {    new Employee() { EmpID = 1, EmpName = "Tom", EmpMarks = 90, Rank = 8} ,    new Employee() { EmpID = 2, EmpName = "Anne", EmpMarks = 60, Rank = 21 } ,    new Employee() { EmpID = 3, EmpName = "Jack", EmpMarks = 76, Rank = 18 } ,    new Employee() { EmpID = 4, EmpName = "Amy" , EmpMarks = 67, Rank = 20} , };Now, let’s use multiple ...

Read More

What is the Keys property of Hashtable class in C#?

Chandu yadav
Chandu yadav
Updated on 11-Mar-2026 156 Views

Gets an ICollection containing the keys in the Hashtable. It displays all the keys in the collection. In the below code, to get all the keys we have used a loop to loop through the collection.foreach (int k in h.Keys) {    Console.WriteLine(k); }The above displays all the keys as shown in the following code −Exampleusing System; using System.Collections; class Program {    static void Main() {       Hashtable h = new Hashtable();       h.Add(1, "India");       h.Add(2, "US");       h.Add(3, "UK");       h.Add(4, "Australia");       h.Add(5, "Netherland");       foreach (int k in h.Keys) {          Console.WriteLine(k);       }    } }Output5 4 3 2 1

Read More

hypot() function in PHP

Samual Sam
Samual Sam
Updated on 11-Mar-2026 142 Views

The hypot() function is used to calculate the hypotenuse of a right-angle triangle. It Returns the length of the hypotenuse in float. Of a right-angled triangle, the longest side is hypotenuse.Syntaxhypot(a, b)Parametersa − Length of first sideb − Length of second sideReturnThe hypot() function Returns the length of the hypotenuse in float.ExampleOutput8.24621125123538.5440037453175

Read More

Initialization of global and static variables in C

Arjun Thakur
Arjun Thakur
Updated on 11-Mar-2026 5K+ Views

In C language both the global and static variables must be initialized with constant values. This is because the values of these variables must be known before the execution starts. An error will be generated if the constant values are not provided for global and static variables.A program that demonstrates the initialization of global and static variables is given as follows.Example#include int a = 5; static int b = 10; int main() {    printf("The value of global variable a : %d", a);    printf("The value of global static variable b : %d", b);    return 0; }OutputThe output ...

Read More

Convert from String to long in Java

karthikeya Boyini
karthikeya Boyini
Updated on 11-Mar-2026 355 Views

To convert String to long, the following are the two methods.Method 1The following is an example wherein we use parseLong() method.Examplepublic class Demo {    public static void main(String[] args) {       String myStr = "5";       Long myLong = Long.parseLong(myStr);       System.out.println("Long: "+myLong);    } }OutputLong: 5Method 2The following is an example wherein we have used valueOf() and longValue() method to convert String to long.Examplepublic class Demo {    public static void main(String[] args) {       String myStr = "20";       long res = Long.valueOf(myStr).longValue();       System.out.println("Long: "+res);    } }OutputLong: 20

Read More

C# Enum IsDefined Method

Chandu yadav
Chandu yadav
Updated on 11-Mar-2026 2K+ Views

The IsDefined method returns true if a given integral value, or its name as a string, is present in a specified enum.The following is our enum −enum Subjects { Maths, Science, English, Economics };The above is initialized by default i.e.Maths = 0, Science = 1, English = 2, Economics = 3Therefore, when we will find 3 using IsDefined(), then it will return True as shown below −Exampleusing System; public class Demo {    enum Subjects { Maths, Science, English, Economics };    public static void Main() {       object ob;       ob = 3;       Console.WriteLine("{0} = {1}", ob, Enum.IsDefined(typeof(Subjects), ob));    } }Output3 = True

Read More
Showing 9031–9040 of 61,248 articles
« Prev 1 902 903 904 905 906 6125 Next »
Advertisements