• 05 October

    Calculate total surface area of Cylinder in java

    In this post, we will see how to calculate total surface area of Cylinder in java. Formula of calculating total surface area of Cylinder is: Surface area of Cylinder = 2 *Π * r * r + 2 *Π * r * h Where r is radius of cylinder and h is height of cylinder […]

  • 10 March

    Print pyramid pattern: 1 3*2 4*5*6 pattern in java

    In this post, we will see how to print the following pyramid pattern. Problem Input : n = 4 Output : 1 3*2 4*5*6 10*9*8*7Input : n = 5 Output : 1 3*2 4*5*6 10*9*8*7 11*12*13*14*15 Solution If you notice the pattern we need to print odd rows in increasing order and even rows in […]

  • 22 January

    Matrix multiplication in java

    In this post, we will see how to multiply two matrices in java. [crayon-607bef5f9980b409991682/] Output: Enter number of rows and columns of first matrix : 2 2 Enter first matrix elements : 2 4 6 8 Enter number of rows and columns of second matrix :2 2 Enter second matrix elements : 3 6 9 […]

  • 22 January

    Java program to add two matrices

    In this post, we will see how to add two matrices in java.I am giving example for 33 matrix. You can extend it to nn matrices. [crayon-607bef5f99b11735679781/] Output: Enter matrix 1 elements : 11 22 33 44 55 66 77 88 99 Enter matrix 2 elements : 10 20 30 40 50 60 70 80 […]

  • 22 January

    Java program to subtract two matrices

    In this post, we will see how to subtract two matrices in java.I am giving example for 33 matrix. You can extend it to nn matrices. [crayon-607bef5f99e27807278664/] Output: Enter Matrix 1 Elements : 11 22 33 44 55 66 77 88 99 Enter Matrix 2 Elements : 10 20 30 40 50 60 70 80 […]

  • 22 January

    Convert celsius to fahrenheit in java

    In this tutorial, we will see simple java program to convert celsius to fahrenheit in java. You can convert celsius to fahrenheit using this formula. fh = (1.8*cen) + 32; [crayon-607bef5f9a11c632516198/] Output: Enter Temperature in Centigrade : 30 Equivalent Temperature in Fahrenheit = 86.0

  • 22 January

    Convert fahrenheit to celsius in java

    In this tutorial, we will see simple java program to convert fahrenheit to celsius in java. You can convert fahrenheit to celsius using this formula. cel = (fh-32) / 1.8; [crayon-607bef5f9a486979580444/] Output: Enter Temperature in Fahrenheit : 79 Equivalent Temperature in Celsius : 26.11111111111111

  • 20 January

    Java program to delete words from sentence

    In this post, we will see how to delete words from the sentence. You can just use String’s replaceAll method to replace the word with empty String(""). Here is simple java program to delete words from the sentence. [crayon-607bef5f9a784968875672/] Output: Enter a String : Java2Blog is a technical blog. Enter a Word you want to […]

  • 20 January

    Java program to remove vowels from String

    In this tutorial we will see how to remove vowels from String in java. Using replaceAll() method We will use String’s replaceAll() method to remove vowels from String. [crayon-607bef5f9ab73150233726/] Output: Enter a String : Java2Blog All Vowels Removed Successfully..!! New String is : Jv2Blg Explaination Take input String from Scanner str1 Call replaceAll() method on […]