JAVA PROGRAMS FOR FILE
1) Java Program to Check Whether an Alphabet is Vowel or Consonant.
2) Java Program to Check Leap Year
3) Java Program to Find the Frequency of Character in a String
4) Write a Java program to perform basic Calculator operations.
5) Write a simple Java program to calculate a Factorial of a number.
6) Write a simple Java program to calculate Fibonacci Series up to n numbers.
7) Write a Java program to find out whether the given String is Palindrome or not.
8) Program to find number of elements in an array
9) Write a Java method to display the middle character of a string.
Note: a) If the length of the string is odd there will be two middle characters.
b) If the length of the string is even there will be one middle character.
10) Write a Java method to check whether a string is a valid password.
Password rules:
A1-password must have at least ten characters.
A2-password consists of only letters and digits.
A3-password must contain at least two digits.
11) Write a Java method (takes n as input) to display an n-by-n matrix.
12) Write a Java method that accepts three integers and checks whether they are
consecutive or not. Returns true or false.
13) Write a Java method that accepts three integers and returns true if one is the
middle point between the other two integers, otherwise false.
14) Write a Java program to print the results of the following operations.
Test Data:
a. -5 + 8 * 6
b. (55+9) % 9
c. 20 + -3*5 / 8
d. 5 + 15 / 3 * 2 - 8 % 3
15) Write a Java program to print an American flag on the screen.
Expected Output
* * * * * * ==================================
* * * * * ==================================
* * * * * * ==================================
* * * * * * ==================================
==============================================
==============================================
==============================================
16) Write a Java program to print a face.
+"""""+
[| o o |]
| ^ |
| '-' |
+-----+
17) Write a Java program to compare two numbers.
18) Write a Java program to calculate the sum of two integers and return true if
the sum is equal to a third integer.
19) Write a Java program to convert seconds to hours, minutes and seconds
20) Write a Java program that accepts two integer values from the user and returns
the largest value. However if the two values are the same, return 0 and find the
smallest value if the two values have the same remainder when divided by 6.
21) Write a Java program that reads a number in inches and converts it to meters.
22) Java Program to Calculate average of numbers using Array
23) Java Program to Add the elements of an Array
24) Java Program to reverse an array
25) Java Program to sort an array in ascending order
26) Java Program to print the elements of an array present on odd Position
27) Java Program to print the elements of an array present on even Position
28) Java Program to copy all the elements of an array into another array
29) Java Program to count the frequency of each element in an array
30) Write the program in java to find duplicate elements of an array
31) Write a program in java Program to find largest element of an array
32) Java Program to Reverse a number using for, while loop and recursion
33) Java Program to check Palindrome string using Recursion
34) Java Program to Reverse a String using Recursion
35) Java Program to find Factorial of a number using Recursion
36) Java Program to generate Random Number
37) Java Program to swap two numbers using bitwise operator
38) Java Program to find smallest of three numbers using ternary operator
39) Java Program to find largest of three numbers using ternary operator
40) Java Program to Find average of 3 numbers
41) Write a program in java to check the number is Peterson Number in Java
42) Write a program in java to check the number Sunny Number in Java
43) Write a program in java to check the number Tech Number in Java
44) Find the Frequency of Each Character in a Given String
45) Java Program for Diamond Shape Pattern
46) Java Program to Print Character Pyramid Pattern
47) Java Program to Print a Pyramid
48) Java Program to Print an Inverted Pyramid
49) Java Program to Print a Right Triangle Star Pattern
50) Java Program to Print an Inverted Right Triangle Star Pattern
51) Java Program to Print a Left Triangle Star Pattern
52) Java Program to Print a Number Pyramid
53) Java Program to Print a Reverse Number Pyramid
54) Java Program to Print a Hollow Square Pattern
55) Java Program to Print a Cross (X) Pattern
56) Java Program to Print a Plus (+) Pattern
57) Java Program to Print a Heart Shape Star Pattern
58) Java Program to Calculate Salary of an Employee
59) Java Program to Calculate Gross Salary of Employee
60) Java Program to Check if a Given Number is Perfect Square