Articles on Trending Technologies

Technical articles with clear explanations and examples

Finding Quadrant of a Coordinate with respect to a Circle in C++

Arnab Chakraborty
Arnab Chakraborty
Updated on 11-Mar-2026 382 Views

We have one circle (center coordinate and radius), we have to find the quadrant of another given point (x, y) lies with respect to the center of the circle, if this is present in the circle, print quadrant, otherwise print error as the point is present outside.Suppose the center of the circle is (h, k), the coordinate of the point is (x, y). We know that the equation of the circle is βˆ’(π‘₯βˆ’β„Ž)2+(π‘¦βˆ’π‘˜)2+π‘Ÿ2=0Now there are few conditions, based on which we can decide the result.𝑖𝑓 (π‘₯βˆ’β„Ž)2+(π‘¦βˆ’π‘˜)2> π‘Ÿ, π‘‘β„Žπ‘’π‘› π‘‘β„Žπ‘’ π‘π‘œπ‘–π‘›π‘‘ 𝑖𝑠 π‘œπ‘’π‘‘π‘ π‘–π‘‘π‘’ π‘‘β„Žπ‘’ π‘π‘–π‘Ÿπ‘π‘™π‘’π‘–π‘“ (π‘₯βˆ’β„Ž)2+(π‘¦βˆ’π‘˜)2= 0, π‘‘β„Žπ‘’π‘› π‘‘β„Žπ‘’ π‘π‘œπ‘–π‘›π‘‘ 𝑖𝑠 ...

Read More

How to get Exception log from a console and write it to external file in java?

Maruthi Krishna
Maruthi Krishna
Updated on 11-Mar-2026 2K+ Views

There are several logging frame works available to log your data in to files. You can also define your own method.Example βˆ’ Using I/O packageFollowing Java program has an array storing 5 integer values, we are letting the user to choose two elements from the array (indices of the elements) and performing division between them. We are wrapping this code in try block with three catch blocks catching ArithmeticException, InputMismatchException and, ArrayIndexOutOfBoundsException. In each of them we are invoking the writeToFile() method.This method accepts an exception object, and appends it to a file using the write() method of the Files ...

Read More

HTML DOM Input URL type Property

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 249 Views

The HTML DOM Input URL type property returns/sets type of Input URL.SyntaxFollowing is the syntax βˆ’Returning string valueinputURLObject.typeSetting type to string valueinputURLObject.type = stringValueString ValuesHere, β€œstringValue” can be the following βˆ’stringValueDetailsemailIt defines that input type is emailurlIt defines that input type is urlradioIt defines that input type is radiotelIt defines that input type is tel and a number keypad is shown for inputExampleLet us see an example for Input URL typeΒ property βˆ’ Input URL type Β  Β form { Β  Β  Β  width:70%; Β  Β  Β  margin: 0 auto; Β  Β  Β  text-align: center; Β  Β } Β  Β * ...

Read More

Can we to override a catch block in java?

Maruthi Krishna
Maruthi Krishna
Updated on 11-Mar-2026 1K+ Views

DescriptionWhen a piece of code in particular method throws an exception, and is handled using try-catch pair. If we are calling this method from another one and, the calling line is wrapped within try-catch pair. Now, how can I override the catch block by the catch block of the calling method.When a piece of code in a method throws an exception (compile time) we must either handle it by wrapping it within the try-catch pair or, throw it (postpone) to the calling method using the throws keyword else a compile time error occurs.In the following Java example the code in ...

Read More

An interesting method to print reverse of a linked list in C++

sudhir sharma
sudhir sharma
Updated on 11-Mar-2026 265 Views

A linked list is a data structure that stores data elements in linked form. Each node of the linked list has a data element and a link.Print reverse of a linked list is a common problem that needs to be addressed in problem solving. So, here we will learn an interesting way to print reverse of a linked list in c++ programming language.Generally print a reverse linked list needs modifications in the list or multiple traversing of the list but this method does not require any such things and also traverses the linked list only once.The logic of this method ...

Read More

Can we throw an Unchecked Exception from a static block in java?

Maruthi Krishna
Maruthi Krishna
Updated on 11-Mar-2026 2K+ Views

A static block is a block of code with a static keyword. In general, these are used to initialize the static members. JVM executes static blocks before the main method at the time of class loading.Examplepublic class MyClass { Β  Β static{ Β  Β  Β  System.out.println("Hello this is a static block"); Β  Β } Β  Β public static void main(String args[]){ Β  Β  Β  System.out.println("This is main method"); Β  Β } }OutputHello this is a static block This is main methodExceptions in static blockJust like any other method in Java when an exception occurs in static block you can handle it using try-catch pair.Exampleimport ...

Read More

C++ program to find two numbers with sum and product both same as N

Ayush Gupta
Ayush Gupta
Updated on 11-Mar-2026 774 Views

In this tutorial, we will be discussing a program to find two numbers (say β€˜a’ and β€˜b’) such that botha+b = N and a*b = N are satisfied.Eliminating β€˜a’ from both the equations, we get a quadratic equation in β€˜b’ and β€˜N’ i.eb2 - bN + N = 0This equation will have two roots which will give us the value of both β€˜a’ and β€˜b’. Using the determinant method to find the roots, we get the value of β€˜a’ and β€˜b’ as, $a= (N-\sqrt{N*N-4N)}/2\ b= (N+\sqrt{N*N-4N)}/2 $Example#include //header file for the square root function #include using namespace std; ...

Read More

Check horizontal and vertical symmetry in binary matrix in C++

Arnab Chakraborty
Arnab Chakraborty
Updated on 11-Mar-2026 403 Views

Suppose we have a binary matrix of order M x N. The task is to check whether the matrix is horizontally symmetric, vertically symmetric or both. One matrix is said to be horizontally symmetric if the ith row is the same as the (M – i)th row, this is said to be vertically symmetric if the jth column is the same as the (N – j)th column. Suppose the input matrices are like below βˆ’011101011This is Horizontally symmetric.111101111This is Vertically symmetric.111101111This is Horizontally as well as vertically symmetric.We will solve this problem using two phases. At first, we will check ...

Read More

C++ program to find uncommon characters in two given strings

Ayush Gupta
Ayush Gupta
Updated on 11-Mar-2026 990 Views

In this article, we will be discussing a program to find out the uncommon characters during comparison of two different given strings.As we know, strings are nothing but an array of characters. Therefore, for comparison we would be traversing through the characters of one string and simultaneously checking if that element exists in the other string.If we let the first string be A and the second string B.Then it would give us A - B. Similarly we can calculate B - A.Combining both of these results we would get( A - B ) βˆͺ ( B - A )i.e the ...

Read More

C++ program to find union and intersection of two unsorted arrays

Ayush Gupta
Ayush Gupta
Updated on 11-Mar-2026 2K+ Views

In this article, we will be discussing a program to find the union and intersection of two given unsorted arrays.Let us denote the two arrays with β€˜A’ and β€˜B’. Then union of those arrays is denoted by A βˆͺ B which is basically an array of all the elements in both the given arrays; provided that each element repeats only once.To find this, we will create a separate array and copy down all the elements from the first array. Then we will traverse through the elements of the second array and check if it is already present in the union ...

Read More
Showing 28861–28870 of 61,299 articles
Advertisements