Aishwarya Naglot

Aishwarya Naglot

Writing clean code… when the bugs aren’t looking.

About

Developer by passion, debugger by instinct. Forever building, occasionally breaking, constantly evolving.

105 Articles Published

Articles by Aishwarya Naglot

105 articles

Explain the pre-processor directives in C language

Aishwarya Naglot
Aishwarya Naglot
Updated on 15-Mar-2026 8K+ Views

The preprocessor is a tool that processes the source code before it passes through the compiler. It works as an initial phase of compilation where it operates under the control of different command lines or directives. Syntax #directive_name [parameters] Pre-processor Directives in C Preprocessor directives are placed in the source program before the main function, begin with the symbol "#" in column one and do not require a semicolon at the end. The commonly used preprocessor directives are − #define #undef #include #ifdef #endif #if #else The preprocessor directives ...

Read More

What are primary data types in C language?

Aishwarya Naglot
Aishwarya Naglot
Updated on 15-Mar-2026 11K+ Views

Primary data types, also known as fundamental data types, are built-in data types in C programming language. The C compiler supports four fundamental data types that serve as the building blocks for storing and working with different kinds of data − Integer − for whole numbers Character − for single characters Float − for decimal numbers Double − for high-precision decimal numbers Syntax // Declaration syntax for primary data types int variable_name; char variable_name; float variable_name; double variable_name; Integer Data Type Integer data types store whole numbers (positive or negative) without ...

Read More

How to delete a string inside a file(.txt) in java?

Aishwarya Naglot
Aishwarya Naglot
Updated on 01-Sep-2025 8K+ Views

In this article, we will learn how to delete a string inside a file (.txt) in Java. The following are the ways to do so: Using FileOutputStream and replaceAll() method. Using replace() method. Using FileOutputStream The FileOutputStream is a class in the java.io package. It is mainly used for writing data to a file. It creates a file output stream to write data to the specified file. To delete a string inside a file using the FileOutputStream class, follow the steps below: Create a file ...

Read More

Java program to delete all the files in a directory recursively (only files)

Aishwarya Naglot
Aishwarya Naglot
Updated on 01-Sep-2025 3K+ Views

To delete all the files in a directory recursively (only files), we can use the class Files, which is part of the java.nio.file package. The Files class helps in performing file operations such as creating, deleting, and copying files. Suppose we have a directory named test with the following structure: file1.txt file2.txt file3.txt subdir1 file4.txt file5.txt subdir2 ...

Read More

Redirecting System.out.println() output to a file in Java

Aishwarya Naglot
Aishwarya Naglot
Updated on 01-Sep-2025 10K+ Views

In Java, the System is a class that provides access to the resources called "System resources". It is a final class, which means it cannot be inherited by any other class. It is a part of the java.lang package. The System.out.println() method prints the data on the console. In this article, we will learn how to redirect the output of the System.out.println() method to a file. Following are few of the ways through we achieve this: Using System.setOut() with PrintStream Using FileOutputStream with PrintStream The filed named out of the System class represents a standard output Stream, an ...

Read More

How can we format a date using the Jackson library in Java?

Aishwarya Naglot
Aishwarya Naglot
Updated on 01-Sep-2025 3K+ Views

Jackson is a Java-based library, and it can be useful to convert Java objects to JSON and JSON to Java objects. A Jackson API is faster than other API, needs less memory, and is good for large objects. We can format a date using the setDateFormat() of ObjectMapper class. This method can be used for configuring the default DateFormat when serializing time values as Strings and deserializing from JSON Strings. Syntax of setDateFormat() public ObjectMapper setDateFormat(DateFormat df) Here, df is the DateFormat instance to be used for formatting dates. Steps to format a date using Jackson in Java Following ...

Read More

Convert POJO to XML using the Jackson library in Java?

Aishwarya Naglot
Aishwarya Naglot
Updated on 01-Sep-2025 7K+ Views

Jackson is a library that allows you to convert Java objects into XML and vice versa. In this example, we will demonstrate how to convert a POJO (Plain Old Java Object) into XML using the Jackson library. Well, if you are not familiar with POJO, it is a simple Java object that does not follow any specific framework or design pattern. It is just a regular Java class with fields and methods. We will use the method writeValueAsString() of the XmlMapper class to convert a POJO into XML. The XmlMapper class is part of the Jackson library and it ...

Read More

How can we ignore the fields during JSON serialization in Java?

Aishwarya Naglot
Aishwarya Naglot
Updated on 01-Sep-2025 14K+ Views

If there are fields in Java objects that do not wish to be serialized, we can use the @JsonIgnore annotation in the Jackson library. The @JsonIgnore can be used at the field level, for ignoring fields during the serialization and deserialization. In this article, we will learn how to ignore the fields during JSON serialization in Java using the Jackson library. Steps to ignore the fields during JSON serialization in Java: In order to use Jackson, you will need to add it to your project. If you use Maven, add the following dependency to your ...

Read More

Differences between Method Reference and Constructor Reference in Java?

Aishwarya Naglot
Aishwarya Naglot
Updated on 01-Sep-2025 3K+ Views

The Method Reference and Constructor Reference are part of Java 8's functional programming features, they used for refering to methods and constructors without executing them. They are often used in conjunction with functional interfaces, such as those defined in the java.util.function package. Method Reference A method reference is a shorthand representation of a lambda expression for calling a method. A method reference refers to a method without executing it. Method references can refer to static methods, instance methods, and constructors. Constructor Reference A constructor reference is a unique kind of method reference that is a reference to a constructor. ...

Read More

Constructor Chaining In Java programming

Aishwarya Naglot
Aishwarya Naglot
Updated on 01-Sep-2025 2K+ Views

The constructor chaining is a specific sequence of calling constructors when a user initializes an object in a certain way. This technique is used when multiple constructors are invoked one after another, based on the instance class. It is also closely related to inheritance, where the role of a subclass constructor is to call the constructor of its superclass. You can perform constructor chaining in two ways: Within the same class - where one constructor calls another constructor of the same class. Across different classes - where a subclass constructor calls ...

Read More
Showing 1–10 of 105 articles
« Prev 1 2 3 4 5 11 Next »
Advertisements