Found 33676 Articles for Programming

Java Program for Int to Char Conversion

Shriansh Kumar
Updated on 19-Jun-2025 12:04:26

353 Views

The given task is to write a Java program that converts an integer into a character. The int and char are primitive datatypes of Java. The int is a 32-bit signed datatype used to store whole numbers, and char holds 16-bit unsigned Unicode characters. The int and char keywords are used to declare an integer variable and a character variable, respectively. We store character variables in a single quotation (' '). Example Scenario To understand the problem statement, let's see an example scenario: Input: int num1 = 83; Output: ch = 'S' Here, num1 is the name of a ... Read More

Java Program for Rotate the Matrix Right by K times

Shriansh Kumar
Updated on 19-Jun-2025 12:11:27

657 Views

Array is a linear data structure that is used to store a group of elements with similar data types. It stores data in a sequential manner. When we create an array of two dimensions, i.e., rows and columns, we call it a matrix. In this article, we will create a matrix of M x N and try to rotate it right by K times. Here, M and N are the size of the row and column, respectively. K is the number of times we want to rotate the matrix. Example Scenarios Let's understand what matrix rotation is with the following ... Read More

Java Nested Loops with Examples

Shriansh Kumar
Updated on 18-Jun-2025 19:09:16

2K+ Views

Loops in Java are called control statements because they decide the flow of execution of a program based on some condition. Java allows the nesting of loops. When we put a loop within another loop, then we call it a nested loop. Nested loops are used when we need to iterate through a matrix array and when we need to do any pattern-based questions. In this article, we are going to learn about Java nested loops with examples. Nested Loops in Java We can create nested loops for the following control statements in Java: ... Read More

Java Program to Access all Data as Object Array

Shriansh Kumar
Updated on 19-Jun-2025 14:23:21

212 Views

Array is a linear data structure that is used to store a group of elements with the same data type. We can create an array with primitive datatypes, and since a class is considered a user-defined datatype in Java,  it is also possible to create an array of objects. In this article, we are going to discuss object arrays. First of all, let's discuss what is an object array, in Java. What is Object array or Array of Objects An array of objects contains reference variables of objects.We follow the same syntax to create an array of primitives and an array ... Read More

Java Program to Access All the Constant Defined in the Enum

Shriansh Kumar
Updated on 19-Jun-2025 14:32:05

204 Views

After JDK version 5, Java introduced the enumeration. It is a group of constants defined using the keyword enum. The final variables in Java are somewhat similar to enumeration. In this article, we will write Java programs in which we define an enum class and try to access all the constants defined in the enum using valueOf() and values() methods. The Java Enum Class We use enum class when we need to define a fixed set of constants. For example, if we want to use the days of the week, planet names, names of all five vowels, etc. Note that all the ... Read More

Java Program to Check Array Bounds while inputting Elements into the Array

Shriansh Kumar
Updated on 19-Jun-2025 14:41:38

157 Views

Array is a linear data structure that is used to store a group of elements with similar data types. It stores data in a sequential manner. Once we create an array, we can't change its size, i.e., it is of fixed length. This article will help you to understand the basic concept of arrays and array bounds in Java. Also, we will discuss Java programs to check array bounds while inputting elements into the array. Array and Array Bound We can access elements of an array by its index. Suppose we have an array of length N, then ... Read More

Java Program to check the accessibility of an Instance Variable by a Static Method

Shriansh Kumar
Updated on 01-Sep-2025 12:12:46

171 Views

In Java, the static methods are defined using static keywords but to declare instance variables we don't use static keywords. Generally, we can't access the instance variable by a static method. In this article, we will create an instance variable and then we will check the accessibility of that instance variable by a static method. Let's understand static method and instance variable first. Java Instance Variable In the context of programming language, variables are the name of containers that contain data of any type. We can say it is a storage unit. A variable can be initialized at the time ... Read More

Java Program to Check if a given Class is an Anonymous Class

Shriansh Kumar
Updated on 19-Jun-2025 16:15:26

192 Views

The type of nested class that has no name is called an anonymous class. Before diving into a Java program to check if a given class is an anonymous class, we need to understand what is a nested class. Let's discuss this in detail. What is a Java Nested Class? A class created within another class in Java is called a nested class. We know that we cannot declare a Java class private, but we can define a nested class as private. There are two types of nested classes in Java: static and non-static. The static nested class is defined ... Read More

Java Program to Check if a given Class is a Local Inner Class

Shriansh Kumar
Updated on 30-May-2025 17:47:00

266 Views

The nested class that is defined inside the body of a method or within a loop, like for and if, is called a local inner class. Before making a Java program to check whether a given class is a local inner class or not, we need to understand the concept of nested classes first. Let's discuss this in detail. Nested Class When we create a class within another class, it is referred to as a nested class. The nested classes share the same scope. It allows the grouping of similar classes and encapsulation (wrapping of similar functionalities in a single unit). ... Read More

How to Perform Grubbs Test in Python

Gourav Bais
Updated on 28-Apr-2023 15:52:21

2K+ Views

Introduction The Grubbs test is a statistical hypothesis testing method to detect outliers in a dataset. Outliers are the observations that disburse the data distribution and are also known as anomalies. The dataset with outliers tends to overfit more than data with a Normal/Gaussian distribution. Hence, it is necessary to tackle the outliers before Machine Learning modeling. Before handling, we must detect and locate the outliers in the dataset. The most popular outliers detection techniques are QQPlot, Inter-Quartile range, and Grubbs statistical test. However, this article will discuss only the Grubbs test to detect the outliers. You will learn: what ... Read More

Advertisements