Java 400+ Practice Programs With Solutions


Java 400+ Practice Programs With Solutions


1 . Write a Java -program to print Unary Minus Operation
2 . Write a Java program to print Pre Increment operation?
3 . Write a Java program to print post Increment operation?
4 . Write a Java program to print Pre Decrement operation?
5 . Write a Java program to print post Decrement operation?
6 . Write a java-program to print addition of two numbers
7 . Write a Java-program to print subtraction of two numbers
8 . Write a Java-program to print multiplication of two numbers
9 . Write a Java-program to print division of two numbers
10 . Write a Java-program to print modular division of two numbers
11 . Write a java-program to print swaping of two numbers with using third variable
12 . Write a Java-program to print swaping of two numbers without using third variable
13 . Write a java-program to print relation of two numbers
14 . Write a Java-program to print logical operators program using &&, || ,!
15 . Write a Java-program to print bitwise AND operation
16 . Write a Java-program to print bitwise OR operation
17 . Write a Java-program to print bitwise CAP operation
18 . Write a Java-program to print bitwise NEGATION operation
19 . Write a Java-program to print bitwise LEFT SHIFT operation
20 . Write a Java-program to print bitwise RIGHT SHIFT operation
21 . Write a Java-program to print odd or even number using ternary operator
22 . Write a Java-program to print max number using ternary operator
23 . Write a Java-program to print MAX Number Amoung 3 Numbers
24 . Write a Java-program to print ODD or Even Number using if else condition
25 . Write a Java-program to print max number using if else condtion
26 . Write a Java-program to check the given number is valid or invalid(value must divisible by 2 and 3)
27 . Write a Java-program to check the given number is valid or invalid(value must divisible by 2 and 3 not 4)
28 . Write a Java-program to check the given number is valid or invalid(value must divisible by 2 and 3 not 4 using 2 conditions)
29 . Write a Java-program to check the given number is valid or invalid(value must between 20 and 30)
30 . Write a Java-program to check the given character is vowel or consonant
31 . Write a Java-program to check the given character is small letter or not
32 . Write a Java-program to check the given character is capital letter or not
33 . Write a Java-program to check the given character is number or not
34 . Write a Java-program to check the given character is symbol letter or not
35 . Write a Java-program to calculate simple interest with following condtions
36 . Write a Java-program to print age
37 . Write a Java-program to print Max Number amoung the three numners using else if
38 . Write a Java-program to check the given character is vowel or consonant( Character must be small letter)
39 . Write a Java-program to check Odd or Even number program using nested if condition(value must be positive)
40 . Write a Java-program to check Odd or Even number using switch
41 . Write a Java-program to check Vowel or Consonant using switch
42 . Write a Java-program to display 1 to 10 values using for loop
43 . Write a Java-program to display 10 to 1 values using for loop
44 . Write a Java-program to display 1 to n values using for loop
45 . Write a Java-program to display display Even Numbers using for loop
46 . Write a Java-program to display Even Number or Odd Number based on the N value using for loop
47 . Write a Java-program to display Even Number or Odd Number based on the N value using single for loop
48 . Write a Java-program count the number of divisible numbers in a given range(1-100) ?
49 . Write a Java-program count the number of divisible numbers in a given range(1-100) without loop
50 . Write a Java-program to print Factorial Number using for loop ?
51 . Write a Java-program to print Factorial of upto N Numbers using for loop ?
52 . Write a Java-program to print sum of natural numbers using for loop ?
53 . Write a Java-program to print sum of Even numbers using for loop ?
54 . Write a Java-program to print sum of Odd numbers using for loop ?
55 . Write a Java-program to print sum of even or odd numbers based on the N value using for loop ?
56 . Write a Java-program to print sum of even or odd numbers based on the N value using single for loop ?
57 . Write a Java-program to display the Table using for loop ?
58 . Write a Java-program to display 1 to 10 values using while loop ?
59 . Write a Java-program to display 10 to 1 values using while loop
60 . Write a Java-program to display 1 to n values using while loop
61 . Write a Java-program to display display Even Numbers using while loop
62 . Write a Java-program to display Even Number or Odd Number based on the N value using while loop
63 . Write a Java-program to display Even Number or Odd Number based on the N value using single while loop
64 . Write a Java-program count the number of divisible numbers in a given range(1-100) using while loop ?
65 . Write a Java-program to print Factorial Number using while loop ?
66 . Write a Java-program to print Factorial of upto N Numbers using while loop ?
67 . Write a Java-program to print sum of natural numbers using while loop ?
68 . Write a Java-program to print sum of Even numbers using while loop ?
69 . Write a Java-program to print sum of Odd numbers using while loop ?
70 . Write a Java-program to print sum of even or odd numbers based on the N value using while loop ?
71 . Write a Java-program to print sum of even or odd numbers based on the N value using single while loop ?
72 . Write a Java-program to display the Table using while loop ?
73 . for and while difference program(Factorial Number using while Loop (value must be positive number))
74 . Write a Java-program to display 1 to 10 values using do while loop ?
75 . Write a Java-program to display 10 to 1 values using do while loop
76 . Write a Java-program to display 1 to n values using do while loop
77 . Write a Java-program to display display Even Numbers using do while loop
78 . Write a Java-program to display Even Number or Odd Number based on the N value using do while loop
79 . Write a Java-program to display Even Number or Odd Number based on the N value using single do while loop
80 . Write a Java-program count the number of divisible numbers in a given range(1-100) using do while loop ?
81 . Write a Java-program to print Factorial Number using do while loop ?
82 . Write a Java-program to print Factorial of upto N Numbers using do while loop ?
83 . Write a Java-program to print sum of natural numbers using do while loop ?
84 . Write a Java-program to print sum of Even numbers using do while loop ?
85 . Write a Java-program to print sum of Odd numbers using do while loop ?
86 . Write a Java-program to print sum of even or odd numbers based on the N value using do while loop ?
87 . Write a Java-program to print sum of even or odd numbers based on the N value using single do while loop ?
88 . Write a Java-program to display the Table using do while loop ?
89 . Write a Java-program to display vowels using continue statement ?
90 . Write a Java-program to display the whose values divisible by 2 and 3 Continue statement in java ?
91 . Write a Java-program to Break the loop which number is divisible by 2 and 3 in java ?
92 . Write a Java-program to print a to z character
93 . Write a Java-program to print A to Z character
94 . Write a Java-program to print character numbers
95 . Write a Java-program to print symbols
96 . Write a Java-program to print ASCII values of a to z
97 . Write a Java-program to print ASCII values of A to Z
98 . Write a Java-program to print ASCII values of Numbers
99 . Write a Java-program to print ASCII values of symbols
100 . Write a Java-program to print global and local variables
101 . Write a Java-program to print Max Number using no return type with no parameterized method
102 . Write a Java-program to print Max Number using no return type with parameterized method
103 . Write a Java-program to print Max Number using return type with no parameterized method
104 . Write a Java-program to print Max Number using return type with parameterized method
105 . Write a Java-program to print Factorial Number using no return type with no parameterized method
106 . Write a Java-program to print Factorial Number using no return type with parameterized method
107 . Write a Java-program to print Factorial Number using return type with no parameterized method
108 . Write a Java-program to print Factorial Number using return type with parameterized method
109 . Write a Java-program to print static method
110 . Write a Java-program to print static variable
111 . Write a Java-program to using static block
112 . Write a Java-program to print addition ,substraction ,multiplication,division using oops (using single class)
113 . Write a Java-program to print addition ,substraction ,multiplication,division using oops (using multiple classes)
114 . Write a Java-program to print Max Number program using no parametarized constructor with no return type with no parametarized method
115 . Write a Java-program to print Max Number program using no parametarized constructor with no return type with parametarized method
116 . Write a Java-program to print Max Number program using no parametarized constructor with return type with no parametarized method
117 . Write a Java-program to print Max Number program using no parametarized constructor with return type with parametarized method
118 . Write a Java-program to print Max Number program using no parametarized constructor with no return type with no parametarized method
119 . Write a Java-program to print Max Number program using parametarized constructor with no return type with parametarized method
120 . Write a Java-program to print Max Number program using parametarized constructor with return type with no parametarized method
121 . Write a Java-program to print Max Number program using parametarized constructor with return type with parametarized method
122 . Write a Java-program to print Factorial Number program using no parametarized constructor with no return type with no parametarized method
123 . Write a Java-program to print Factorial Number program using no parametarized constructor with no return type with parametarized method
124 . Write a Java-program to print Factorial Number program using no parametarized constructor with return type with no parametarized method
125 . Write a Java-program to print Factorial Number program using no parametarized constructor with return type with parametarized method
126 . Write a Java-program to print Factorial Number program using no parametarized constructor with no return type with no parametarized method
127 . Write a Java-program to print Factorial Number program using parametarized constructor with no return type with parametarized method
128 . Write a Java-program to print Factorial Number program using parametarized constructor with return type with no parametarized method
129 . Write a Java-program to print Factorial Number program using parametarized constructor with return type with parametarized method
130 . Write a Java-program using this.(dot)
131 . Write a Java-program with out using this()
132 . Write a Java-program with using this()
133 . Write a Java program to print student details using single inhiritance concept
134 . Write a Java program to print student details using multilevel inhiritance concept
135 . Write a Java program to print student and faculty details using hirarchy inhiritance concept
136 . Write a Java program with out using abstract keyword
137 . Write a Java program with using abstract keyword
138 . Abstract Practice Program 1
139 . Write a Java program to create object for abstract class
140 . Abstract Practice Program 2
141 . Abstract Practice Program 3
142 . Abstract Practice Program 4
143 . Abstract Practice Program 5
144 . Down Casting Program
145 . Write a Java-program using super.(dot)
146 . Write a Java-program with out using super() no parameterized
147 . Write a Java-program with out using super() with parameterized
148 . Write a Java-program with using polymorphism
149 . Write a Java-program using static method overloading
150 . Write a Java-program using dynamic method overloading
151 . Write a Java-program using Constructor overloading
152 . Write a Java-program using static method overridding
153 . Write a Java-program using dynamic method overridding
154 . Write a java program to illustrate inner class accessing inner class properties
155 . Write a package Program
156 . Write a package program using encapsulation
157 . Write a package program using data abstraction
158 . Write a package program using inheritance
159 . write a package program using polymorphism
160 . write a inner package program using polymorphism
161 . Write a program to handled the Arithmetic Exception
162 . Write a program to handled the InputMismatch Exception
163 . Write a program to handled the ArrayIndexOutOfBoundsException
164 . Write a program to handled the StringIndexOutOfBoundsException
165 . Write a java program to know exception details using Exception class
166 . Write a java program to know above exception details using printStackTrace() Method
167 . Write a java program to know above exception details using getMessage Method
168 . Write a Throws Keyword Program
169 . Write a Finally block Program
170 . Write a program to handle negative age exception
171 . Write a program to handle negative salary exception
172 . Write a Simple interest program to handle negative amount and duration and interest using user defined exception
173 . Write a String length program
174 . Write a string charAt() method program
175 . Write a string toLowerCase() Program
176 . Write a String toUpperCase() program
177 . Write a string concat() program
178 . Write a string compareTo program
179 . Write a string compareToIgnoreCase() Program
180 . Write a string equals program
181 . Write a string equalsIgnoreCase() program
182 . Write a string startsWith() program
183 . Write a string endsWith() program
184 . Write a string indexOf() program
185 . Write a string lastIndexOf() program
186 . Write a String substring() program
187 . Write a string trim() program
188 . Write a StringBuffer insert() program
189 . Write a StringBuffer delete() program
190 . Write a StringBuffer append() program
191 . Write a StringBuffer replace() Program
192 . Write a StringBuilder length program
193 . Write a StringBuilder charAt() method program
194 . Write a StringBuilder toLowerCase() Program
195 . Write a StringBuilder toUpperCase() program
196 . Write a StringBuilder concat() program
197 . Write a StringBuilder compareTo program
198 . Write a StringBuilder compareToIgnoreCase() Program
199 . Write a StringBuilder equals program
200 . Write a StringBuilder equalsIgnoreCase() program
201 . Write a StringBuilder startsWith() program
202 . Write a StringBuilder endsWith() program
203 . Write a StringBuilder indexOf() program
204 . Write a StringBuilder lastIndexOf() program
205 . Write a StringBuilder substring() program
206 . Write a StringBuilder trim() program
207 . Write a StringBuilder insert() program
208 . Write a StringBuilder delete() program
209 . Write a StringBuilder append() program
210 . Write a StringBuilder replace() Program
211 . Write a Java-program to Count the number of vowels in a given string ?
212 . Write a Java-program to Count the number of Consonants in a given string ?
213 . Write a Java-program to Count the number of spaces in a given string
214 . Write a Java-program to Count the number of special characters in a given string ?
215 . Write a Java-program to Count the number of letters in a given string ?
216 . Write a Java-program to Count the number of Numbers in a given string ?
217 . Write a Java-program to Remove vowels in a given string ?
218 . Write a Java-program to Remove consonants in a given string ?
219 . Write a Java-program to Remove special characters in a given string ?
220 . Write a Java-program to Remove spaces in a given string ?
221 . Write a Java-program to Remove letters in a given string ?
222 . Write a Java-program to Remove numbers in a given string ?
223 . Write a Java-program to print duplicate characters from the string ?
224 . Write a Java-program to print unique(distinct (or non-repeating characters) ) characters from the string ?
225 . Write a java program How to check if two strings are anagrams of each other?
226 . How to reverse a string in Java without using the reverse method ?
227 . How to count the occurrence of the given character in a string?
228 . How to check if a string is a palindrome?
229 . How to count the number of words in a given string sentence?
230 . How to reverse the words from the given string sentence?
231 . How to swap two strings without using the third variable?
232 . Write a java program to display message a 2sec time gap without using Multi Threading
233 . Write a java program to display message a 2sec time gap using Thread class
234 . Write a java program to display message a 2sec time gap using runnable interface
235 . Write a java program to display addition program and subtraction program with 2 sec time gap
236 . online Ticket Booking program without using Thread Synchronization
237 . Online Ticket Booking program with using synchronized method
238 . Online Ticket Booking program with using synchronized block
239 . Write a Thread setName() program
240 . Write a Thread getName() program
241 . Write a Thread getPriority() program
242 . Write a Thread setPriority() program
243 . Write a Thread sleep() program
244 . Write a Thread suspend() program
245 . Write a Thread resume() program
246 . Write a Thread isAlive() program
247 . Write a Thread currnetThread() program
248 . Write a Thread join() program
249 . Write a Thread run() program
250 . Write a Thread start() program
251 . Write a Thread stop() program
252 . Write one dimensional array initialization program