Programming Articles - Page 370 of 3363

How to Uncompress a File in Golang?

Sabid Ansari
Updated on 26-Apr-2023 11:09:34

1K+ Views

In today's world of technology, compressing files has become an essential part of daily life. It not only helps to save disk space but also speeds up file transfers. However, at times, it becomes necessary to uncompress these files to extract the data inside. In this article, we will discuss how to uncompress a file in Golang, a popular programming language. Step 1: Importing the Necessary Packages Before we can start uncompressing files, we need to import the necessary packages. Golang comes with a built-in "compress" package that provides support for various compression algorithms. To uncompress files, we need to ... Read More

Java Program to check Eligibility of TPP students for appearing in Interviews

Shriansh Kumar
Updated on 06-Jun-2025 13:58:45

338 Views

Checking Eligibility of TPP Students in Java Consider the following table for eligibility criteria of different companies for appearing in interviews: CGPA ... Read More

Java Program to Check if JVM is 32 or 64 bit

Shriansh Kumar
Updated on 01-Aug-2024 11:01:47

891 Views

In this article, we will learn how to determine whether the installed JVM in your system is 32 bit or 64 bit. For this operation, we use the getProperty() method of System class, which helps in retrieving system property of specified argument. In computer architecture, 32 bit and 64 bit refers to those components that operate on data in 32-bit units and 64-bit units respectively. 64 bit machines are said to be faster and more secure compare to the 32 bit machines. What is JVM? JVM is Java Virtual Machine that is responsible for executing the byte code. It is ... Read More

Java program to check if a given number is perfect number

Shriansh Kumar
Updated on 06-Jun-2025 13:17:34

2K+ Views

When the sum of factors of a given number (after discarding the given number) is equal to the number itself is called a perfect number. The sum of these divisors is known as the aliquot sum. Therefore, we can say that a number is perfect if it matches its aliquot sum. All known perfect numbers are even. Problem Statement In this article, we will create Java programs to check if a given number is perfect or not. Let's try to understand the given problem through some examples: Example Scenarios: Input: number = 496 Output: 496 is a perfect number ... Read More

Java Program to Add the data from the Specified Collection in the Current Collection

Shriansh Kumar
Updated on 19-Jun-2025 16:01:31

320 Views

In Java, a collection is an object that allows us to group several numbers of objects as a single unit. The Collection interface is the root of the collection framework. We can perform various operations on collection like adding, removing, iterating, searching and retrieving objects. In this article, we will discuss Java programs to add data from the specified collection to the current collection with the help of addAll() method. Using addAll() method of Collection Interface The addAll() method of Collection interface adds data from a specified collection into current collection. It returns a boolean value, which is TRUE if the ... Read More

Java Program to Add the nth Square Series

Shriansh Kumar
Updated on 30-May-2025 17:29:59

333 Views

The sum of the nth squares series is a form of arithmetic progression where the sum of squares is arranged in a sequence with the initial term as 1, and n being the total number of terms. 12 + 22 + 32 + ... + n2 In this article, we will discuss a Java program to add the nth square series. But, before that, let's see an example scenario: Example Scenario: Input: num = 6 Output: sum = 91 It will be calculated as: 12 + 22 + 32 + 42 + 52 + 62 = 1 ... Read More

Java Program to Allocate and Initialize Super Class Members using Constructor

Shriansh Kumar
Updated on 06-Jun-2025 13:57:24

563 Views

In Java, super refers to the parent class instance, and to inherit members of the super class to the child class, we use the extends keyword. Before writing a Java program to allocate and initialize super class members using a constructor, let's go through some concepts we are going to use in this article. What is Constructor? A Java constructor is a class member that initializes instance variables of a class. It is very similar to a method, but the difference is that methods can return a value, but a constructor does not return any value because it can't have any return ... Read More

Java Program to Add two Numbers without using Arithmetic Operator

Shriansh Kumar
Updated on 19-Jun-2025 15:46:18

4K+ Views

Arithmetic operators such as "+", "-", "*", and "/" are used to perform mathematical operations like addition, subtraction, multiplication, modulo, and division. We have added two numbers using the "+" operator, but in this article, we are going to learn a few Java programs that can add two numbers without using arithmetic operators. The following operators best serve this purpose: Increment operators (++) Bitwise operators ... Read More

Java Program to Calculate Interest for FDs and RDs using Inheritance

Shriansh Kumar
Updated on 06-Jun-2025 14:04:57

943 Views

Inheritance is a concept that allows us to access the properties and behaviors of one class in another class. The class whose methods and member variables are inherited is known as the super class or parent class, and the class that inherits these methods and member variables is known as the child class or subclass. In Java, we use the extends keyword to inherit a class. Problem Statement Write Java programs that calculate interest for Fixed Deposits (FDs) and Recurring Deposits (RDs) using inheritance. The program should prompt the user to choose between FD and RD, enter the amount and duration, ... Read More

Java Program to Calculate difference between two Time Periods

Shriansh Kumar
Updated on 19-Jun-2025 10:19:22

886 Views

We are given two time periods, and our task is to write a Java program to calculate the difference between them. For this problem, we can use classes and methods of java.time, java.util, and java.text packages. SimpleDateFormat class Date class LocalDate class Period class parse() method between() method As we move further in this article, we will understand the uses of these classes and methods in calculating the difference between two time periods. Some examples ... Read More

Advertisements