Difference Between void main and int main in C/C++

Akansha Kumari
Updated on 09-Jun-2025 15:28:49

37K+ Views

The main() function in C and C++ is anentry point of a program from where the execution begins. And there are two common ways available to define the main function; int main() and void main(). In this following article we will learn the differences between these two in detail. The main() function is the same like other functions, which takes arguments and returns some value. A point to keep in mind is that the execution of a program always begins from the main() function. When a program runs, the operating system calls the main() and the value returned from it ... Read More

Override Final Method of Superclass in Java

Alshifa Hasnain
Updated on 09-Jun-2025 14:49:19

2K+ Views

Any method that is declared as final in the superclass cannot be overridden by a subclass. If we try to override the final method of the super class, we will get a compile-time error.  Rules for Implementing Method Overriding The method declaration should be the same as that of the method that is to be overridden. The class (subclass) should extend another class (superclass), prior to even try overriding. The Sub Class can never override final methods of the Super Class. Final method A method is declared final when ... Read More

isalpha and isdigit in C/C++

Tapas Kumar Ghosh
Updated on 09-Jun-2025 14:48:51

39K+ Views

Both isalpha() and isdigit() are the part of C/C++ library function which can be used to check whether a given character is an alphabetical letter or a digit, respectively. These fuctions accept the given character/digit as input and determine the presence of letter or digit in correct/incorrect form. What is isalpha() in C/C++? The isalpha() function is used to check that a character is an alphabet or not. This function is declared in ctype.h header file. It returns an integer value, if the argument is an alphabet otherwise, it returns zero. Syntax Following is the basic syntax of isalpha() in ... Read More

Create an Unmodifiable Map in Java 9

Alshifa Hasnain
Updated on 09-Jun-2025 14:28:11

433 Views

In this article, we will learn to create an unmodifiable Map in Java 9. First, we will learn about Map and Unmodifiable Map and after that we will be knowing the different ways through which we can create an unmodifiable map (Map.of method and unmodifiableMap() Method). Map In Java, a Map is an interface in the Collections framework used to store data in the form of key-value pairs. Each key in the map is unique and maps to some value. Some of the implementations of the Map interface are: HashMap ... Read More

Differences Between orTimeout and completeOnTimeout Methods in Java 9

Alshifa Hasnain
Updated on 09-Jun-2025 14:27:47

2K+ Views

In this article, we will learn about the differences between the orTimeout() and the completeOnTimeout() methods in Java. Both the orTimeout() and completeOnTimeout() methods are defined in the CompletableFuture class, and these two methods were introduced in Java 9. CompletableFuture class The CompletableFuture class, introduced in Java 8, represents a Future that can have its value and status set explicitly. It also supports dependent functions and actions that are triggered upon the completion of the future. In Java 9, the CompletableFuture API received further enhancements. The following are some common methods of the CompletableFuture class: ... Read More

Change Background and Foreground Color of JToolTip in Java

Alshifa Hasnain
Updated on 09-Jun-2025 14:27:05

368 Views

In this article, we will learn to change the background and foreground color of a JTooltip. We will be using UIManager.put(), we customize the tooltip for a JLabel by setting a white background and green text, which will improve the appearance of the default tooltip. What is a JToolTip? A JToolTip is a subclass of the JComponent class, and we can create a tooltip for any Java component by using the setToolTipText() method. It can be used to set up a tooltip for the component. The important methods of a JToolTip class are getAccessibleContext(), getComponent(), paramString(), and updateUI(). How to ... Read More

Convert Floating Point Number to Binary in Python

Sumana Challa
Updated on 09-Jun-2025 14:26:50

3K+ Views

Floating number is a number that has a decimal point and can represent both large and very small values. Binary number is a number expressed in the base-2 numeral system, using 0's and 1's. The conversion of floating-point number to binary representation in Python requires to represent the number in the IEEE 754 format(a set of representation of numerical values and symbols). For example, consider a floating number 9.87, its IEEE 754 32-bit binary representation (1 bit for the sign, 8 bits for exponent, and 23 bits for the significand) is "01000001000111011110101110000101". In this article, we will discuss different ways ... Read More

Break a List into Chunks of Size N in Python

Sumana Challa
Updated on 09-Jun-2025 14:25:31

604 Views

The objective is to break a list into chunks of a specific size (n), that is, splitting a list into sublists where each sublist contains n elements. For example, if the list is [12, 33, 11, 56, 44, 89, 23, 34, 12] and the chunk size is 3. Then the output has to be - [[12, 33, 11], [56, 44, 89], [23, 34, 12]]. To break a list into chunks of size n in Python, we use list comprehensions, Numpy library, slicing and others. Let's discuss all the approaches in detail with examples - Using List Comprehension List comprehension provides ... Read More

Implement a Rounded JTextField in Java

Alshifa Hasnain
Updated on 09-Jun-2025 14:20:34

3K+ Views

In this article, we will learn to implement a rounded JTextField in Java. The JtextField is rectangular in shape, and to create a custom JTextField with rounded corners, we will use the RoundRectangle2D class and with the help of fillRoundRect() and drawRoundRect() methods in Java Swing. What is a JTextField? A JTextField is a subclass of the JTextComponent class, and it is one of the most important components that allows the user to an input text value in a single-line format.  Below is the graphical representation of a JTextField:  A JTextField class will generate an ActionListener interface when we ... Read More

Show/Hide Echo Character of JPasswordField in Java

Alshifa Hasnain
Updated on 09-Jun-2025 14:20:00

2K+ Views

In this article, we will learn to show/hide the echo character of a JPasswordField in Java. The password in this will be hidden with *. And we will be using the setEchoChar() method to toggle between hidden and visible text in a Swing based application. What is a JPasswordField? A JPasswordField is a subclass of JTextField, and each character entered in a JPasswordField can be replaced by an echo character. This allows confidential input for passwords. By default, the echo character is the asterisk(*). The important methods of JPasswordField are get password(), getText(), getAccessibleContext() and etc. What is the echo ... Read More

Advertisements