Tag: tutorials

JAR file operations in Java

Below are some of the common JAR File operations in Java. JAR file operations in Java jar cf This command creates a JAR file.Syntax : jar cf jar-file input-file jar tf This command is used to view the contents of the JAR file.Syntax : jar tf jar-file jar xf This command is used to extract the contents of a JAR file.Syntax : jar xf jar-file

Using block for SQLConnection in C#

The using statement in C# can also be used to ensure that the resources are automatically cleaned before the using block exits. One of the criteria of the Using statement is that the items being created in the using statement must implement IDisposable interface. For example, you can use the using block to open the SQL Connection, retrieve the data. Using block for SQLConnection in…

C Program to find the factorial of a number using Recursive function

Problem Write a program in C to find the factorial of a number using recursion and display the result. How to find the factorial of a number using recursion in C ? The Formula to find the factorial of a number (n) is (n!) = 1*2*3*4….n Here’s a C program to demonstrate this. Output Abundantcode.com Coding samples Enter a Number : 5 Factorial of 5…

How to check the Equality of Anonymous Types in C#?

The Equals method is used to check the equality. The anonymous types will be equal of it has the same order, type, name and values. How to check the Equality of Anonymous Types in C#? Below is a sample sourcecode demonstrating how to check the Equality of Anonymous types in c#.

C Program to find if the input character is an Alphabet or not

Problem Write a program in C to check whether the character that was entered by the user is a alphabet or not. How to find if the input character is an alphabet or not in C ? Output Abundantcode.com Coding sample                                               Please enter a character: A                                              A is an alphabet.

How to Compare two arrays in Java ?

You can compare arrays in java using the Array.deepEquals() method . The Array.deepEquals() method in Java lets the developers to compare array objects and return true if both the arrays contains the same objects. How to Compare two arrays in Java ? Below is a sample code snippet demonstrating the usage of Array.deepEquals() to compare two arrays. Output Comparing input and input2————————–trueComparing input and input3————————–false

How to Check if Integer is a multiple of a number in Java?

If you want to check if the integer value is a multiple of a number in Java , you can use the modulus (%) operator . If you get the result as zero , then it is considered as multiple of a number. How to Check if Integer is a multiple of a number in Java? Below is a sample code snippet demonstrating the usage…

VB.NET Program to display "Hello, World!"

Problem Write a program in VB.NET to display “Hello, World!” on the screen. VB.NET Program to display “Hello, World!” in Console Window. This is a simple VB.NET program that displays “Hello, World!” on the console window. Output Hello, World! In the above program , Main() is the starting point for the program and the Console.WriteLine function is used to display the string on the Console…

RegisterArea in ASP.NET MVC

In the previous article, we provided you an overview of the areas in ASP.NET MVC. When a new area is created in ASP.NET MVC, a file with the area name suffixed by AreaRegistration will be created. In the example as described in the previous article, the AbundantcodePayrollAreaRegistration.cs contains the following This class contains the RegisterArea method which is used to register the route with the…

The ? (ternary) Operator in C#

The ? Operator is the ternary operator and takes the following form Expression1? Expression2: Expression3; The Expression1 is an expression which returns Boolean result. Expression2 is considered if the Expression1 is true else Expression2 is taken.

C Program to find if the input is a Armstrong Number or Not

Problem Write a program in C to find if a given number is Armstrong number or not. How to check if a number is a Armstrong number or not in C programming Language ? A given number is a Armstrong number of order n if abc… = an + bn + cn + … For example , 371 is a Armstrong number because the result…

What are the different types of comments in C#?

There are 3 different types of comments in C#. These include 1. Single Line CommentThe single line comment is specified using the symbol // Eg: // this is a AbundantCode comment 2. Multi Line CommentThe Multiline comment can be specified using the symbol /* */ Eg: /* This is a test comment */ 3. XML CommentThis is a special kind of comment which is generally…

How to append an array to another in JavaScript ?

In JavaScript , you may want to append one array to another array(s) to combine their elements resulting in to a single array. How to append an array to another in JavaScript ? You can use the concat method of JavaScript to achieve the same. Below is a sample code snippet demonstrating the usage of the concat method of array in JavaScript to combine multiple…

C Program to calculate the power of a number

Problem Write a program in C to calculate and display the power of a number. How to calculate the power of a number in C ? Output Abundantcode.com coding sample                                               Enter the base number: 2                                         Enter an exponent: 3                                              Answer = 6

C Program to display full pyramid using numbers

Problem Write a program in C to print full pyramid using numbers as shown below.The program should take the number of rows as input.          1       2 3 2     3 4 5 4 3   4 5 6 7 6 5 4 How to create and  display full pyramid pattern in C using numbers ? Output Abundantcode.com coding samples Enter the limit: 4…

Java – How to declare Hexadecimal literal ?

Problem statement You need to declare an Hexadecimal literal in Java and display the result on a console window. Solution Hexadecimal numbers can contain numbers from 0-9 as well as characters A-F where A-F represents 10-15. You can prefix the numbers with 0X to denote it as hexa decimal number as shown below. The output of the above program will be 10 21