Articles on Trending Technologies

Technical articles with clear explanations and examples

What are the differences between a JTextPane and a JEditorPane in Java?

Alshifa Hasnain
Alshifa Hasnain
Updated on 22-Apr-2025 2K+ Views

In Java, a JTextPane is an extension of JEditorPane which provides word processing features like fonts, text styles, colors and etc. If we need to do heavy-duty text processing, we can use this class, whereas a JEditorPane supports display/editing of HTML and RTF content and can be extended by creating our own EditorKit. JTextPane A JTextPane is a subclass of JEditorPane. A JTextPane is used for a styled document with embedded images and components. A JTextPane is a text component that can be marked up with the attributes that are represented graphically and it can use a DefaultStyledDocument as the ...

Read More

Whitespace in C++

Akansha Kumari
Akansha Kumari
Updated on 22-Apr-2025 9K+ Views

The term Whitespace in C++ refers to the characters used for formatting, like creating spaces, tabs, and newlines. These are usually invisible in the source code output (meaning they don't appear in the actual program output); they just help to format the code and improve readability. Types of whitespace characters Here are the following four common types of whitespace characters mostly used in C++. Space (' ') Tab ('\t') Newline ('') Carriage return ('\r') Space (' ') It's a most basic whitespace ...

Read More

What does \'Ek Onkar\' mantra in Sikhism mean?

Ridhi Arora
Ridhi Arora
Updated on 22-Apr-2025 5K+ Views

‘Ik onkar’ or ‘Ek Onkar’ is a very sacred mantra for Sikhs all over the world. It is a basic mantra or a devotional hymn offered to their Lord. Also known as the 'mool' mantra , it is said to be Guru Nanak's first teaching sermon.What Does It Mean?The literal translation of "ik onkar satnam karta poorak nirabhu niravair akal murat ajuni saibham gur prasad jap Aadh Sach jugaad sach hai bhee sach nanak hose bhee sach " is that there is only one god, whose name is 'Truth'. He is the creator and is without fear. He is without ...

Read More

C++ Program to Implement Russian Peasant Multiplication

Ravi Ranjan
Ravi Ranjan
Updated on 22-Apr-2025 660 Views

The Russian Peasant multiplication is used to multiply two numbers without using the multiplication operator. It involves constant use of halving and doubling the numbers. In this article, we have two integers, our task is to find the product of these two integers by implementing russian peasant multiplication in C++. Steps to Implement Russian Peasant Multiplication We will follow these simple steps to find the product using Russian Peasant multiplication: We have created a function russianPeasant() that accepts both the numbers (n and m) as arguments. Then we used a ...

Read More

How can we parse a nested JSON object in Java?

Aishwarya Naglot
Aishwarya Naglot
Updated on 22-Apr-2025 16K+ Views

Sometimes, we need to parse a nested JSON object, which means an object inside another object. In this article, let's learn about how to parse a nested JSON object in Java. If you don't know about JSON, refer JSON overview. Parsing a Nested JSON Object in Java? We can achieve this using some of the popular Java libraries. Those are listed below: Using org.json library : We will use jsonObject.getJSONObject method to parse a nested JSON object. Using Gson library : We will use JsonParser.parseString(json).getAsJsonObject(). Using Jackson library : In this, We will use ObjectMapper.readTree(json) method. Now, ...

Read More

How can we sort a JSONArray in Java?

Aishwarya Naglot
Aishwarya Naglot
Updated on 22-Apr-2025 10K+ Views

In this article, we will learn how to sort a JSON array in Java. But first, let’s understand what JSON is. If you do not have knowledge about JSON, you can refer to the tutorial JSON Overview. Now, let's see different ways to sort a JSON array in Java. Ways to sort a JSON array in Java Following are different ways to sort a JSON array in Java - Sort JSON array Without any Dependency Using org.json library: Methods are getJSONArray() and getJSONObject() Using Gson library: Methods ...

Read More

How to get the values of the different types from a JSON object in Java?

Aishwarya Naglot
Aishwarya Naglot
Updated on 22-Apr-2025 31K+ Views

We often need to extract values from a JSON object. In this article, we will learn how to get the values of the different types from a JSON object in Java. What is JSONObject? Java JSONObject is a class in the org.json package that represents a JSON object. Refer JSONObject for more information. Let's see the steps to get the values of different types from a JSON object in Java. Getting different values from a JSON object Before we start, let's add the required library to our program. We can add a .jar file, or we can use a Maven ...

Read More

Convert a Map to JSON using the Gson library in Java?

Aishwarya Naglot
Aishwarya Naglot
Updated on 22-Apr-2025 4K+ Views

Converting a map to a JSON object is our task here. Let's see how to convert a map to a JSON object in Java using the Gson library. Converting a Map to JSON using the Gson library JSON is a simple and lightweight data interchange format. It stores data in key-value pairs. A map is also a collection of key-value pairs. So, we can easily convert a map to a JSON object. If you are not familiar with JSON, refer JSON. And if you want to know more about Map, refer Map. Gson is developed by Google. It is an ...

Read More

How can we check if a JSON object is empty or not in Java?

Aishwarya Naglot
Aishwarya Naglot
Updated on 22-Apr-2025 12K+ Views

In this article, let's learn how to check if a JSON object has any values or not in Java. If you don't know about JSON, refer JSON. We will use the org.json library and its methods like isEmpty(), length(), and keys() to check if a JSON object is empty or not. We can check if a JSON object is empty or not using the following methods: Using isEmpty() method Using length() method Using keys() method Let's see how to use each of them one by one. ...

Read More

How to convert a JSON array to CSV in Java?

Aishwarya Naglot
Aishwarya Naglot
Updated on 22-Apr-2025 6K+ Views

JSON is a lightweight data interchange format. It is mostly used in web applications for sending and receiving data. To know more about JSON, refer JSON. A JSON array is a collection of JSON objects. It is similar to a list in Java. CSV is the format for storing tabular data in plain text. It is a comma-separated value. It is used for data exchange between applications. Let's see how CSV format looks like: JSON array The following is an example of the JSON array: [ { "Name": "Ansh", ...

Read More
Showing 31071–31080 of 61,297 articles
Advertisements