Programming Articles - Page 403 of 3363

Java program to show inherited constructor calls parent constructor by default

Rudradev Das
Updated on 18-Nov-2024 22:30:58

404 Views

In this article, we will learn about constructors in Java. Constructors initialize objects when they are created. We will also see how the parent constructor is called in inheritance. Problem StatementWe will demonstrate possible approaches to show how the inherited constructor calls the parent constructor by default.Different approaches The following are the different approaches to show how the inherited constructor calls the parent constructor by default− Demonstrating inheritance properties ... Read More

Java Program to Show Different Access Levels

Rudradev Das
Updated on 02-Jan-2025 19:12:41

317 Views

In this article, we will explore the use of access modifiers in Java by demonstrating their functionality in different scenarios. Access Modifiers Access modifiers are used to set the feature of visibility of some particular classes, interfaces, variables, methods, constructors, data members, and the setter methods in Java programming language. In a Java environment, we have different types of access modifiers. Default - If we declare a function, it will be visible only within a particular package. ... Read More

Java program to set minimum and maximum heap size

Rudradev Das
Updated on 15-Oct-2024 10:39:06

787 Views

The Java heap is a particular memory area which is used to store the objects and represent them as or by an instance in Java Virtual Machine. The Java heap can be shared between two threads as long as the environment is occupied by some running applications. The heaps are sorted in a stack memory and follow the Last In First Out (LIFO) method after the creation of an object in JVM. When the size of the heap memory is compared to the stack, the spare objects are cleared by the GarbageCollector automatically. The heap memory is divided into three ... Read More

Java Program to Separate the Individual Characters from a String

Rudradev Das
Updated on 12-Apr-2023 17:40:29

5K+ Views

In the field of computer science, the string is a collection of a continuous character data sets. Here in this particular problem we will use some spaces to execute the logic. The individual characters present here in the string can be accessed through its index to perform the code. Here is a general flow to build a logic code to separate the individual characters from a string in a Java environment. Define a string with characters. Print the individual characters present from a given string. Set an initial to zero. Print the string by using the function string.charAt(i). Iterate ... Read More

Java Program to Illustrate String Interpolation

Shriansh Kumar
Updated on 31-Jul-2024 19:53:44

1K+ Views

String interpolation is a concatenation technique used to display output text dynamically or effectively by replacing the placeholder characters with variables (or strings in the subsequent examples). It restructures the code and prevents the need to repeatedly use variables to produce the output. It makes it efficient to write lengthy variable names or text just by replacing the placeholder with the variable names allocated to strings. String Interpolation in Java There are several ways in Java to perform String Interpolation with the help of the concatenation operator and library function or class. Here, we will discuss four different methods ... Read More

Java Program to Illustrate Use of Binary Literals

Sakshi Ghosh
Updated on 28-Jan-2025 18:23:53

603 Views

In this article, we will learn to illustrate the use of binary literals in Java. This feature is particularly useful when working with low-level data manipulation, such as in embedded systems or when dealing with bitwise operations. What is Binary Literal? A binary literal is a number that is denoted using binary digits that are 0s and 1s. The values written in data types – byte, int, long, and short can be easily expressed in a binary number system. The prefix 0b or 0B is added to the integer to declare a binary literal. For example − ... Read More

Java Program to Illustrate the usage of Octal Integer

Sakshi Ghosh
Updated on 12-Apr-2023 12:30:06

276 Views

Octal Integer is a number system having a base of 8 and digits from 0 to 7. Int data type is taken into account to store an octal number. The usage of the Octal number system is to be discussed here − Converting decimal to Octal Converting octal to decimal. Conversion from a Decimal number system to an Octal Number system Basics of Conversion To convert any decimal number into its equivalent octal number: Keep dividing the decimal number by the base of the octal number system which is 8 till the quotient 0 is received. Remember ... Read More

Finding the Inverse Hyperbolic Cosine of Complex Number in Golang

Sabid Ansari
Updated on 12-Apr-2023 12:15:37

195 Views

Golang has a built-in math package that provides various mathematical functions. In this article, we will focus on finding the inverse hyperbolic cosine of a complex number using the math/cmplx package in Golang. Inverse Hyperbolic Cosine Function The inverse hyperbolic cosine function (acosh) is the inverse function of the hyperbolic cosine function (cosh). It is defined for real numbers x ≥ 1, and its range is the set of non-negative real numbers. For complex numbers, acosh is defined as − acosh(z) = ln(z + sqrt(z^2 - 1)) where ln is the natural logarithm, sqrt is the square root, and ... Read More

Finding the Inverse Cosine of Complex Number in Golang

Sabid Ansari
Updated on 12-Apr-2023 12:14:16

192 Views

The inverse cosine of a complex number is the angle whose cosine is that complex number. In Golang, we can use the cmath.Acos function to find the inverse cosine of a complex number. In this article, we will learn how to find the inverse cosine of a complex number in Golang with examples. Syntax func Acos(z complex128) complex128 The cmath.Acos function takes a complex number as input and returns its inverse cosine value as a complex number. Example 1 Let's find the inverse cosine of the complex number (1+0i). package main import ( "fmt" ... Read More

Finding the Integer Value of Specified Number in Golang

Sabid Ansari
Updated on 12-Apr-2023 12:11:46

598 Views

In Go language, integers are numeric values that represent whole numbers without a fractional component. Integers can be signed or unsigned, and can be of various sizes depending on the number of bits used to represent them. Sometimes it is necessary to obtain the integer value of a specified number in order to perform various calculations. In this article, we will discuss how to find the integer value of a given number in Golang. Using Type Casting to Convert a Float to an Integer One way to obtain the integer value of a given number in Golang is to use ... Read More

Advertisements