Difference Between int and long

Tapas Kumar Ghosh
Updated on 05-May-2025 18:35:59

8K+ Views

In programming, int and long are the part of primitive data type. The int stores the integer value while long stores the larger range of values like a whole number. In this article, we will see the differences between int and long data types. int (Integer) Data Type The keyword int representing the integer value. It store the both positive and negative values such as -1, 45, -78, 85, etc., but not fractional and decimal values. The value ranges from –2, 147, 483, 648 to 2, 147, 483, 647. Behavior of int in Different Languages Following is the list of ... Read More

Set a Border to JCheckBox in Java

Alshifa Hasnain
Updated on 05-May-2025 18:33:11

730 Views

In this article, we will learn to set a border for JCheckBox in Java. JCheckBox is a Swing component that is commonly used in user interface selection. Although it includes a default appearance, we can customize its look by setting borders in order to have a good visual effect. What is a JCheckBox? A JCheckBox is a component that extends JToggleButton, and an object of JCheckBox represents an option that can be checked or unchecked. Syntax The following is the syntax for JCheckBox initialization: JCheckBox Checkbox_name = new JCheckBox(); If there are two or more options, then any ... Read More

Set Shortcut Key to JButton in Java

Alshifa Hasnain
Updated on 05-May-2025 18:32:59

2K+ Views

In this article, we will learn to set the shortcut key to a JButton in Java. In Swing-based applications, we can implement the addition of keyboard shortcuts to buttons to enable quicker navigation by the user. What is a JButton? A JButton is a subclass of AbstractButton, and it can be used to add platform-independent buttons to a Java Swing application. When the button is pressed or clicked, a JButton can generate an ActionListener interface; it can also generate the MouseListener and KeyListener interfaces. Setting the Shortcut Key for JButton We can also set the shortcut keys for a JButton ... Read More

Implement Word Wrap in JTableHeader of a JTable in Java

Alshifa Hasnain
Updated on 05-May-2025 18:32:47

923 Views

In this article, we will learn to implement the word wrap JTableHeader of a JTable in Java. The Java Swing default JTableHeader does not support word wrapping. This is a problem if you have long column headers. We can implement this by customizing the DefaultTableModel class or the AbstractTableModel class. JTableHeader A JTableHeader is a subclass of the JComponent class. When we create a JTable object, the constructor creates a new JTableHeader object to manage the table component's header. Syntax The following is the syntax for JTableHeader Declaration: public class JTableHeader extends JComponent The JTableHeader object is associated with ... Read More

Read and Parse JSON Array Using Java

Alshifa Hasnain
Updated on 05-May-2025 18:32:29

60K+ Views

In this article, we will learn to read/parse a JSON array using Java. A JSON array is an ordered collection of values that are enclosed in square brackets, i.e., it begins with ‘[’ and ends with ‘]’. The values in the arrays are separated by ‘, ’ (comma). Sample JSON array The following is the syntax for JSON array initialization: { books": [ Java, JavaFX, Hbase, Cassandra, WebGL, JOGL] } Reading (Parsing) JSON array in Java The following are the different approaches for reading/parsing a JSON array in Java: JSON-Simple maven dependency ... Read More

Check Whether Graph is DAG in C++

Farhan Muhamed
Updated on 05-May-2025 18:29:48

2K+ Views

DAG stands for Directed Acyclic Graph. It is a special type of graph where all edges are directed and there are no cyclic connections of edges. In this article, we will discuss how to check whether a graph is a DAG using Kahn’s algorithm (BFS based topological sorting). What is DAG? A DAG is a directed graph with no cycles. That means in this type graph it is not possible to start from any node and follow a sequence of edges such that you will return back to the starting node. DAGs are commonly used in applications like task ... Read More

C++ Program to Implement Graph Structured Stack

Farhan Muhamed
Updated on 05-May-2025 18:29:34

719 Views

In this article, we will learn what is graph structured stack and how to implement it in a C++ program. What is Graph Structured Stack? Graph structured stack is a directed acyclic graph, where each directed path represents a stack. In this types of stack, the flow of execution is not linear like a traditional stack, instead the flow is represented using a graph structure. Each node in the graph can represent a function call or a state, and the edges define possible transitions or calls. This type of stacks are useful in advanced control flow handling like backtracking, ... Read More

C++ Program to Implement Bit Array

Farhan Muhamed
Updated on 05-May-2025 18:29:04

3K+ Views

Bit array is used to store true/false or yes/no type of values in very less memory. In this article, we will see how to create and use a bit array in C++. What is Bit Array? Bit array is a special array where each element can hold only 0 or 1. Instead of using a full byte (8 bits) for each boolean value, a bit array stores multiple values using just one bit each. Meaning, in a normal array of bool values, each value takes at least one byte. But in bit array, we store 8 values in one ... Read More

How AI Can Help You Perform Better in Exams

Harleen Kaur
Updated on 05-May-2025 18:09:02

184 Views

AI tools can greatly improve your performance and confidence, whether you're in school, college, or getting ready for competitive tests. Read this article to understand how AI can help students prepare better for their exams by delivering intelligent practice tools.How AI can Help you Perform Better in Exams?Specific EducationEvery child learns differently. Some like to read or listen, while others like to understand blind subjects. The platforms powered by AI adjust the speed, qualifications and deficiencies of each student. Through quiz and analysis, these technologies evaluate your knowledge and then change lessons to focus on areas that want to improve. ... Read More

Double Address Operator and & in C++

Akansha Kumari
Updated on 05-May-2025 17:06:22

20K+ Views

&& is a new reference operator defined in the C++11 standard. int&& a means "a" is an r-value reference. && is normally only used to declare a parameter of a function. And it only takes an r-value expression.Simply put, an r-value is a value that doesn't have a memory address. E.g., the number 6 and character 'v' are both r-values. int a, a is an l-value, however, (a+2) is an r-value. Example #include using namespace std; void foo(int&& a) { cout

Advertisements