Basic java programs
- 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-6767cf010ffde921858279/] 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-6767cf011025a081522907/] 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-6767cf011032b676729953/] 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-6767cf0110405153708496/] 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-6767cf01104ce416662289/] 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-6767cf011056f242186092/] 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
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-6767cf011060c506312964/] 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.
- 20 January
Java program to print Diamond pattern
In this tutorial, we will see java program to print diamond pattern. [crayon-6767cf011068c994040852/] That’s all about printing diamond pattern in java.
- 19 January
How to Compare Two Strings in Java
In this post, we will see how to compare two String in java. As you might know, String implements Comparable interface, you can use compareTo method to compare two String in java. [crayon-6767cf011070a788595418/] Output: Enter First String : Java Enter Second String : Blog First String is Greater than Second String. That’s all about How […]