- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Here, as per the given problem pattern needs to be displayed using recursive approach.Recursive function is the one that calls itself n number of times. There can be ‘n’ number of recursive function in a program. The problem working with recursive function is their complexity.AlgorithmSTART Step 1 -> function int printpattern(int n) If n>0 Printpattern(n-1) Print * End IF End Step 2 -> function int pattern(int n) If n>0 pattern(n-1) End IF Printpattern(n) Print End STOPExample#include int printpattern(int n) { if(n>0) { ... Read More
Here we will see how to check whether a given input is numeric string or a normal string. The numeric string will hold all characters that are in range 0 – 9. The solution is very simple, we will simply go through each characters one by one, and check whether it is numeric or not. If it is numeric, then point to the next, otherwise return false value.Example#include using namespace std; bool isNumeric(string str) { for (int i = 0; i < str.length(); i++) if (isdigit(str[i]) == false) return false; //when ... Read More
Here, we have used ItemListener to handle JCheckBox events i.e. whenever any of the CheckBox is selected.For example; When any of the sports like Football CheckBox is checked, event is fired and a message is visible in the botton.The following is an example to handle JCheckBox events with an ItemListener:Exampleimport java.awt.*; import java.awt.event.*; import javax.swing.*; public class SwingDemo { private JFrame mainFrame; private JLabel headerLabel; private JLabel statusLabel; private JPanel controlPanel; public SwingDemo(){ prepareGUI(); } public static void main(String[] args){ SwingDemo swingControlDemo = new SwingDemo(); ... Read More
JDBC provides support 5 transaction isolation levels through Connection interface.TRANSACTION_NONE: It is represented by integer value 0 does not support transactions.TRANSACTION_READ_COMMITTED: It is represented by integer value 2 supports transactions allowing Non-Repeatable Reads and, Phantom Reads.TRANSACTION_READ_UNCOMMITTED: It is represented by integer value 1 supports transactions allowing Dirty Reads, Non-Repeatable Reads and, Phantom Reads.TRANSACTION_REPEATABLE_READ: It is represented by integer value 4 supports transactions allowing only Phantom Reads.TRANSACTION_SERIALIZABLE: It is represented by integer value 8 supports transactions with out allowing Dirty Reads, Non-Repeatable Reads and, Phantom Reads.The supportsTransactionIsolationLevel() method of the DatabaseMetaData interface is used to determine whether the underlying database supports ... Read More
To set the alignment of the label content along the X axis on the left, use the setHorizontalAlignment() method and set the location. Let us first set a label component. We have set the label background color as well so that we can check the alignment of the label’s content properly −JLabel label = new JLabel("Country "); label.setPreferredSize(new Dimension(190, 100)); label.setOpaque(true); label.setBackground(Color.BLUE); label.setForeground(Color.WHITE);Now, we will align the label content along the X axis on the left by seeting location as LEFT −label.setHorizontalAlignment(JLabel.LEFT);The following is an example to set the alignment of the JLabel content along the X axis on the ... Read More
For this, use the CHAR_LENGTH() function in MySQL. Let us first create a table −mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, Subject longtext ); Query OK, 0 rows affected (1.17 sec)Now you can insert some records in the table using insert command −mysql> insert into DemoTable(Subject) values('MySQL, MongoDB'); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable(Subject) values('MySQL, MongoDB'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable(Subject) values('MongoDB'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable(Subject) values('MySQL'); Query OK, 1 row affected (0.15 sec) Display all records from the table using select statement : mysql> select *from DemoTable;Output+----+---------------+ | Id | Subject | +----+---------------+ | 1 | MySQL, MongoDB | | 2 | MySQL, MongoDB | | ... Read More
The element is used in HTML to display abbreviations. The Abbreviation object represent this element.In the below example, we will learn how to access an abbreviation object −Example Live Demo Demo Heading BCCI Display the abbreviation title Abbreviation Title function display() { var a = document.getElementById("myid").title; document.getElementById("demo").innerHTML = a; } OutputClick on the button to display the title −
The java.lang.ClassCastException is one of the unchecked exception in Java. It can occur in our program when we tried to convert an object of one class type into an object of another class type.When will be ClassCastException is thrownWhen we try to cast an object of Parent class to its Child class type, this exception will be thrown.When we try to cast an object of one class into another class type that has not extended the other class or they don't have any relationship between them.ExampleLive Democlass ParentTest { String parentName; ParentTest(String n1){ parentName = n1; } public ... Read More
The HTML DOM input month disabled property returns and modify whether the input field of type=”month” in a HTML document is disabled or not.SyntaxFollowing is the syntax −1. Returning disabledobject.disabled2. Modifying disabledobject.disabled = true | falseExampleLet us see an example of HTML DOM input month defaultValue property − Live Demo html{ height:100%; } body{ text-align:center; color:#fff; background: linear-gradient(62deg, #FBAB7E 0%, #F7CE68 100%) center/cover no-repeat; height:100%; } p{ font-weight:700; font-size:1.2rem; ... Read More
Here we will see how we can get the absolute differences of odd and even indexed elements in an array. The absolute difference indicates that if the difference of one pair is negative, the absolute value will be taken. For an example, let the numbers are {1, 2, 3, 4, 5, 6, 7, 8, 9}. So the even position elements are 1, 3, 5, 7, 9 (starting from 0), and odd place elements are 2, 4, 6, 8. So the difference for even placed data are |1 - 3| = 2, then |2 - 5| = 3, |3 - 7| ... Read More
To Continue Learning Please Login
Login with Google