Here you will get java program for matrix addition. If you have ever done addition of two matrices in your maths subject then you can easily do this in java also. It can be done in following way. Read two matrices in 2D array a[][] and b[][] respectively inside loop. Now add each element of …
Here you will get example to upload file to server using servlet. File uploading is a very common and important feature of any website. In servlet it can be done in many ways. But in this tutorial I am sharing the two most commonly used methods. Also Read: Download File From Server Using Servlet Example How …
Here you will learn about java private constructor. What is private constructor in Java? We can make a constructor private by using private access modifier. Private constructor prevents the instantiation of class from outside. If needed we can create the instance only inside the class. Where to use Java private constructor? We can use private …
Here you will get program to convert decimal to binary in Java. Below I have shared 3 different methods for java decimal to binary conversion. Also Read: Convert Binary to Decimal in Java Convert Decimal to Binary in Java 1. Integer.toString() Method We can convert a decimal number to binary using toString() method of Integer class. …
Here you will get program for caesar cipher in Java for encryption and decryption. Caesar Cipher is an encryption algorithm in which each alphabet present in plain text is replaced by alphabet some fixed number of positions down to it. Take below example. Plain Text: ABCD Key: 3 Cipher Text (Encrypted Message): DEFG As key is 3 so …
Here you will get java program to check even or odd number. How to check? If number is completely divisible by 2 then it is even otherwise odd. In our program we will find the remainder of number by dividing it by 2 using modulus (%) operator. If remainder is 0 then number is even …
Here you will get java program to swap two numbers without using third variable or temporary variable. We can do this in 3 ways as mentioned below. Also Read: Java Program to Swap Two Numbers Using Temporary Variable 1. Using Addition & Subtraction Operator We can swap two numbers using addition (+) and subtraction (-) …
Here you will get java program to swap numbers using temporary variable. It can be done in following way. temp = a a = b b = temp Also Read: Java Program to Swap Two Numbers Without Using Third Variable