George John

George John

789 Articles Published

Articles by George John

Page 38 of 79

Local Class in C++

George John
George John
Updated on 19-Nov-2024 3K+ Views

A class declared inside a function is known as a local class in C++ as it is local to that function, where its scope is limited to that function. Syntax Here the syntax for a local class is given as follows. #include using namespace std; void func() {  class LocalClass {  }; } int main() {  return 0; } In the above syntax, func() is a function, and class LocalClass is defined inside the function. So, it is known as a local class. A local class name can only be used in its function and not outside it. Also, the ...

Read More

Java program to count the child of root node in a JTree

George John
George John
Updated on 13-Nov-2024 392 Views

In this article, we will go over a Java program that counts the number of child nodes of the root node in a JTree using Java. This program uses the getChildCount() method to retrieve and display the count of direct child nodes under the root. This is helpful for applications involving hierarchical structures, like directories or organizational charts. Steps to count the child of the root node in a JTree Following are the steps to count the child of the root node in a JTree −Import the necessary classes JFrame, JTree, and DefaultMutableTreeNode from java.swing package.Create a main class named SwingDemo.Define the ...

Read More

Java program to increase the row height in a JTable

George John
George John
Updated on 29-Sep-2024 2K+ Views

In the given article, we will learn to write a program in Java to increase the row height in a JTable. The example creates a table with different languages and their difficulty levels and then modifies the row height using the setRowHeight() method. Steps to increase the row height in a JTable  Following are the steps to increase the row height in a JTable − Import the necessary classes from javax.swing package. Initialize a DefaultTableModel and create a JTable with it. Add columns to represent languages and ...

Read More

Java program to set JComboBox in JOptionPane

George John
George John
Updated on 29-Sep-2024 2K+ Views

In this article, we will explore how to create a graphical user interface (GUI) in Java using JComboBox and JOptionPane. The program will display a pop-up dialog that contains a drop-down list, allowing the user to select their favorite sport from a list. By default, one of the options will be pre-selected, but users can change the selection.  Steps to set JComboBox in JOptionPane Following are the steps to set JComboBox in JOptionPane − Create a JPanel by initializing a JPanel to hold the components. Create a JComboBox by setting up a JComboBox ...

Read More

Java program to set title position

George John
George John
Updated on 11-Sep-2024 2K+ Views

In this article, you'll learn how to position the title of a border in a Java Swing application using the setTitlePosition() method. We'll position the title above the border's top line by utilizing the TitledBorder.ABOVE_TOP constant. This technique is useful for customizing the appearance of your Swing components. To set title position, use the setTitlePosition() method in Java. Let’s say we have to position the title above the border's top line. For that, use the constant ABOVE_TOP for the border − setTitlePosition(TitledBorder.ABOVE_TOP); Steps to set title position Following are the steps to set title position in Java − ...

Read More

Java program to print all unique words of a string

George John
George John
Updated on 16-Aug-2024 2K+ Views

In this article, we will learn to find unique words in a string using the Map utility of Java because of its property that it does not contain duplicate keys. To find unique words first get all words in the array to compare each word, for this split string based on space/s. If other characters such as comma(, ) or full stop (.) are present then using required regex first replace these characters from the string. Insert each word of string as the key of Map and provide the initial value corresponding to each key as is unique if this ...

Read More

Addressing modes of 8051

George John
George John
Updated on 31-Oct-2023 202K+ Views

In this section, we will see different addressing modes of the 8051 microcontrollers. In 8051 there are 1-byte, 2-byte instructions and very few 3-byte instructions are present. The opcodes are 8-bit long. As the opcodes are 8-bit data, there are 256 possibilities. Among 256, 255 opcodes are implemented.The clock frequency is12MHz, so 64 instruction types are executed in just 1 µs, and rest are just 2 µs. The Multiplication and Division operations take 4 µsto to execute.In 8051 There are six types of addressing modes. Immediate AddressingModeRegister AddressingModeDirect AddressingModeRegister IndirectAddressing ModeIndexed AddressingModeImplied AddressingModeImmediate addressing modeIn this Immediate Addressing Mode, the data ...

Read More

Interfacing DAC with 8051 Microcontroller

George John
George John
Updated on 14-Sep-2023 52K+ Views

In this section we will see how DAC (Digital to Analog Converter) using Intel 8051 Microcontroller. We will also see the sinewave generation using DAC.The Digital to Analog converter (DAC) is a device, that is widely used for converting digital pulses to analog signals. There are two methods of converting digital signals to analog signals. These two methods are binary weighted method and R/2R ladder method. In this article we will use the MC1408 (DAC0808) Digital to Analog Converter. This chip uses R/2R ladder method. This method can achieve a much higher degree of precision. DACs are judged by its ...

Read More

How to cast from VARCHAR to INT in MySQL?

George John
George John
Updated on 07-Sep-2023 43K+ Views

To cast VARCHAR to INT, we can use the cast() function from MySQL. Here is the syntax of cast() function. cast(anyValue as dataType) For our example, we will create a table with the help of CREATE command. mysql> create table VarchartointDemo -> ( -> Value varchar(100) -> ); Query OK, 0 rows affected (0.51 sec) After creating a table, let us insert some records into the table with the help of INSERT command. The query is as follows − mysql> insert into VarchartointDemo values('123'); Query OK, 1 row affected (0.26 sec) ...

Read More

How to create a table with date column?

George John
George John
Updated on 02-Sep-2023 105K+ Views

To create a table with only date column, you can use DATE type. Let us first create a table −mysql> create table DemoTable    (    StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    StudentName varchar(20),    StudentAdmissionDate DATE    ); Query OK, 0 rows affected (0.47 sec)Insert records in the table using INSERT command −mysql> insert into DemoTable(StudentName, StudentAdmissionDate) values('Chris', now()); Query OK, 1 row affected, 1 warning (0.12 sec) mysql> insert into DemoTable(StudentName, StudentAdmissionDate) values('Robert', curdate()); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable(StudentName, StudentAdmissionDate) values('David', '2019-05-21'); Query OK, 1 row affected (0.16 sec)Display all ...

Read More
Showing 371–380 of 789 articles
« Prev 1 36 37 38 39 40 79 Next »
Advertisements