Chandu yadav

Chandu yadav

810 Articles Published

Articles by Chandu yadav

Page 6 of 81

How to throw a C++ exception?

Chandu yadav
Chandu yadav
Updated on 11-Mar-2026 302 Views

Exception handling is used to handle the exceptions. We can use try catch block to protect the code. Exception can be thrown anywhere within the code block. The keyword “throw” is used to throw an exception.Here is an example of throw in C++ language,Example#include using namespace std; int display(int x, int y) {    if( y == 0 ) {       throw "Division by zero condition!";    }    return (x/y); } int main () {    int a = 50;    int b = 0;    int c = 0;    try {       c = display(a, b);       cout

Read More

Data Types we cannot use to create array in C

Chandu yadav
Chandu yadav
Updated on 11-Mar-2026 418 Views

An array can be created using all data types such as int, char, float, double etc. But creating an array by using the void data type is not possible. An error will be displayed if that is done.A program that demonstrates this is given as follows.Example#include #include int main() {    void arr1[4];    printf("A void array");    return 0; }OutputThe above program returns the following error.error: declaration of ‘arr1’ as array of voids void arr1[4];Now let us understand the above program.An array arr1 of void data type is created in the above program. Since this is not ...

Read More

Call the run() method of the Timer Task in Java

Chandu yadav
Chandu yadav
Updated on 11-Mar-2026 830 Views

The java.util.TimerTask.run() method looks onto the action to be performed by the task. It is used to carry out the action performed by the task.Declaration −The java.util.TimerTask.run() method is declared as follows −public abstract void run()Let us see an example program to call the run() method of the Timer Task −Exampleimport java.util.*; class MyTask extends TimerTask {    public void run() {       System.out.println("Running");    } } public class Example {    public static void main(String[] args) {       // creating timer task, timer       TimerTask task = new MyTask();       Timer ...

Read More

expm1() in C++

Chandu yadav
Chandu yadav
Updated on 11-Mar-2026 94 Views

The function expm1() is used to calculate the exponential raised to the power of any number minus one. It returns the value of (exponential raised to the power of a) - 1.Here is the mathematical expression of expm1(),expm1(a) = (e^a) - 1Here is the syntax of expm1() in C++ language,float expm1(variable_name);Here,variable_name − Any name given to the variable whose value is calculated.Here is an example of expm1() in C++ language,Example#include #include using namespace std; int main() {    int x = 10;    float y = 8.28;    cout

Read More

C# DateTime Max Value

Chandu yadav
Chandu yadav
Updated on 11-Mar-2026 6K+ Views

To set the max value for a Date, use the DateTime property MaxValue.DateTime max = DateTime.MaxValue;Now, display the value of max to get the maximum value of a date as shown below.Exampleusing System; using System.Linq; public class Demo {    public static void Main() {       DateTime max = DateTime.MaxValue;       Console.WriteLine(max);    } }Output12/31/9999 11:59:59 PM

Read More

C# Console BufferHeight Property

Chandu yadav
Chandu yadav
Updated on 11-Mar-2026 176 Views

Use the BufferHeight gets or sets the height of the buffer area.Use the property like this −Console.BufferHeightLet us see the complete example.Exampleusing System; class Demo {    static void Main() {       Console.WriteLine("Buffer height (rows) = "+Console.BufferHeight);    } }OutputBuffer height (rows) = 0

Read More

What is the scope of a private member variable of a class in C#?

Chandu yadav
Chandu yadav
Updated on 11-Mar-2026 501 Views

Only functions of the same class can access its private members. Private access specifier allows a class to hide its member variables and member functions from other functions and objects.Exampleusing System; namespace RectangleApplication {    class Rectangle {       //member variables       private double length;       private double width;       public void Acceptdetails() {          length = 10;          width = 14;       }       public double GetArea() {          return length * width;       }   ...

Read More

Passing and Returning Objects in Java

Chandu yadav
Chandu yadav
Updated on 11-Mar-2026 5K+ Views

As we know it is core concept that in Java there is always pass by value and not by pass by reference.So in this post we will focus on that how this concept get validated in case of passing primitive and passing reference to a method.In case when a primitive type is passed to a method as argument then the value assigned to this primitive is get passed to the method and that value becomes local to that method, which means that any change to that value by the method would not change the value of primitive that you have ...

Read More

Convert.ToChar Method in C#

Chandu yadav
Chandu yadav
Updated on 11-Mar-2026 1K+ Views

The Convert.ToChar method is used to convert a specified value to a Unicode integer.We have declared an sbyte variable.sbyte byteVal = 200;Now, use the Convert.ToChar() method to convert the sbyte value to a Unicode integer.charVal = Convert.ToChar(b);Let us see another example.Exampleusing System; public class Demo {    public static void Main() {       sbyte[] byteVal = { 92, 111, 115 };       char charVal;       foreach (sbyte b in byteVal) {          charVal = Convert.ToChar(b);          Console.WriteLine("{0} converted to '{1}'", b, charVal);       }    } }Output92 converted to '' 111 converted to 'o' 115 converted to 's'

Read More

define() function in PHP

Chandu yadav
Chandu yadav
Updated on 11-Mar-2026 914 Views

The define() function defines a constant.Syntaxdefine(const_name,value,case_insensitive)Parametersconst_name − The name of the constant.value − The value of the constant.case_insensitive − The constant name should be case-insensitive.ReturnThe define() function returns true on success or false on failure.ExampleThe following is an example that defines a constant.OuptutThe following is the output.This is it!

Read More
Showing 51–60 of 810 articles
« Prev 1 4 5 6 7 8 81 Next »
Advertisements