Articles on Trending Technologies

Technical articles with clear explanations and examples

How does Java process the backspace terminal control character?

Shriansh Kumar
Shriansh Kumar
Updated on 20-Jul-2023 1K+ Views

The backspace terminal control character is a special character represented by the ‘\b’notation. It is used to move the cursor one character back. It comes under Java escape characters, these characters are used with backslash (\) and hold a special meaning to the compiler. In this article, we will understand and see the practical implementation of‘\b’ notation through Java example programs. Working of Backspace Terminal Control Character Two types of situations may arise while working with this escape character. First, when we hard code the backspace character into a String and the second, when we take input using a keyboard. ...

Read More

Different Ways to Copy Files in Java

Shriansh Kumar
Shriansh Kumar
Updated on 20-Jul-2023 2K+ Views

Java provides different ways to copy files including the ‘File’, ‘FileInputStream’ and‘FileOutputStream’ classes. There are times when we need to take a backup, compress a file or share it with others. In these situations, copying that file becomes necessary. Weare going to explore the methods and classes that will help us to copy the content of one file to another file through Java programs. Before jumping to the example program directly, let’s discuss some classes and built-in methods that we will be using. This will build a foundation for understanding the code. Note that these classes and methods are associated ...

Read More

How are parameters passed in Java?

Shriansh Kumar
Shriansh Kumar
Updated on 20-Jul-2023 2K+ Views

The most frequent query asked by beginner programmers is that how are parameters passed in Java. Generally, the programming languages use pass by value and pass byreference for passing parameters to a method. However, Java does not support both approaches rather it uses pass by value to pass both primitive and reference type values. In this article, we are going to understand passing parameters by value through exampleprograms. Passing Parameters to a Method in Java Let’s start this discussion by understanding the storage mechanism of Java. The referencevariables, names of methods and classes are stored in stack and their values ...

Read More

Different Ways to Print First K Characters of the String in Java

Shriansh Kumar
Shriansh Kumar
Updated on 20-Jul-2023 326 Views

A string is a class in Java that stores a series of characters enclosed within double quotes.Those characters are actually String-type objects. The string class is available in the‘java.lang’ package. Suppose we have given a string and a positive integer ‘k’. Now, thejob is to print that string's first 'k' characters in Java. Also, check whether the length ofgiven string is less than or not, if so print the original string. Java Program to Print First K Characters of the String Let’s understand the given problem with a few examples − Instance String st1 = “TutorialsPoint”; String st2 = “Tutorial”; ...

Read More

How to Add Custom Class Objects to the TreeSet in Java?

Shriansh Kumar
Shriansh Kumar
Updated on 20-Jul-2023 1K+ Views

TreeSet is a class of Java Collection Framework that implements the SortedSet Interface. Remember that it stores elements in ascending order and does not allow duplicate values. We need to stick with this condition while adding custom class objects to the TreeSet otherwise we will encounter a ClassCastException. Here, custom class objects mean userdefined objects that are created with the help of a constructor. Program to add Custom Class Objects to the TreeSet Earlier in the previous section, we discussed that if we failed to follow the condition of TreeSet, we will get a ClassCastException. To avoid this, we need ...

Read More

Getter and Setter in Java

Shriansh Kumar
Shriansh Kumar
Updated on 20-Jul-2023 3K+ Views

Getter and setter are two special methods in Java that allow accessing and modifying data members' values. They are mostly used in encapsulation and data hiding to protect our sensitive data from unauthorized access. In encapsulation, we group related data and behavior together in a class and hide the implementation details from the outside world. Data hiding means preventing direct access of the members of class from the internal state of an object. In this article, we will explain what getter and setter methods are in Java and how they are useful in data hiding. Getter and Setter methods The ...

Read More

Extract substrings between any pair of delimiters

Way2Class
Way2Class
Updated on 20-Jul-2023 1K+ Views

Delimiters are the characters that separate a string from other characters, for example in a sentence in our normal day to day reading activity, we find out the different words because it is separated by spaces. We have () parenthesis as main delimiters in mathematical and regular expressions. The concept of substrings and their manipulation is very important in programming, especially in c which is a language used to write compilers and assemblers. The delimiters are identified in the string and the characters after the starting delimiter are copied into another variable, until the ending delimiter. The == ...

Read More

Largest number not exceeding N that does not contain any of the digits of S

Way2Class
Way2Class
Updated on 20-Jul-2023 293 Views

The challenge of finding the largest number not exceeding a given number N and not containing any of the digits in a string S is a problem that involves string manipulation and number theory. The goal is to determine the greatest possible number that is less than or equal to N while also excluding all of the digits found in the string S. For instance, consider a scenario where N is equal to 1000 and S is equal to "42". In this scenario, the largest number not exceeding N and not containing any of the digits in S would be ...

Read More

Remove all the occurrences of a character from a string using STL

Way2Class
Way2Class
Updated on 20-Jul-2023 3K+ Views

STL basically stands for Standard Template Library, which is a collection of pre-written code frequently used in Data structures and Algorithms. It was developed in the early 1990s by Meng Lee and Alexander Stepanov. It consists of mainly three components known as containers, algorithms and iterators. Containers are objects that stores and manipulate data such as list, vector, set, map and stack. Algorithm are functions which works on the data stored in the containers such as searching, sorting and also manipulating data. Iterators are object that navigates through the elements of a container easily. STL has became an ...

Read More

How to Extract Bold Text Only from a List in Excel

Pradeep Kumar
Pradeep Kumar
Updated on 20-Jul-2023 2K+ Views

Excel is a powerful tool that offers a variety of functions for data manipulation and analysis. To extract bold text only from a list in Excel, you can use a VBA macro. Extracting Bold Text Only from a List in Excel Here, we will first create a formula using the VBA application and then use it to complete the task. So let us see a simple process extract bold text only from a list in Excel. Step 1 : Consider an Excel sheet where you have a list of sentences as shown in the below image. On current visible ...

Read More
Showing 35471–35480 of 61,297 articles
Advertisements