java programs
- 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-6729d2ead54ac366376593/] 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-6729d2ead60e7702978305/] 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-6729d2ead61a8341790721/] 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-6729d2ead622a233907855/] 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-6729d2ead62b4860609230/] Output: Enter a String : Java2Blog All Vowels Removed Successfully..!! New String is : Jv2Blg Explaination Take input String from Scanner str1 Call replaceAll() method on […]
- 20 January
Java program to calculate arithmetic mean
In this tutorial, we will see simple java program to calculate arithmetic mean. Here is simple algorithm to calculate arithmetic mean. Calculate sum of elements in the array Divide it by total number of element in the array. [crayon-6729d2ead6350736987824/] Output: Please enter count of numbers you want to Enter ? 5 Enter 5 Numbers : […]
- 20 January
Java program to count positive, zero and negative numbers
In this post, we will see Java program to count positive, zero and negative numbers [crayon-6729d2ead63cd062559442/] Output: Enter 10 Numbers : 10 0 45 -10 67 0 76 -33 64 -92 5 Positive Numbers 3 Negative Numbers 2 Zero That’s all about Java program to count positive, zero and negative numbers
- 20 January
Program to find frequency of characters in a string in java
In this tutorial, we will see simple program to find frequency of characters in a string in java. There are multiple ways to solve this proble. Let’s see one by one. Using counter array Here is the algorithm for the same. Initialize counter array of 256 length Iterate over String and increase count by 1 […]
- 20 January
Java program to count number of words in sentence
In this tutorial, we will see a simple java program to count number of words in sentence. [crayon-6729d2ead6595279224647/] Output: Enter a Sentence : Java2Blog is a technical blog. Total number of words are 5 That’s all about Java program to count number of words in sentence.