This repository contains a collection of Java coding practice problems covering basic to advanced concepts.
This repository serves as a resource for individuals looking to improve their Java programming skills. It includes a variety of Java programs and coding exercises that cover a wide range of concepts, from basic syntax to more advanced topics. Whether you are a beginner looking to learn Java or an experienced programmer seeking to sharpen your skills, you'll find something here to challenge and enhance your Java knowledge.
S.No | Program |
1 | Write a Java program to print ‘Hello World!’ on screen |
2 | Write a Java program to print the sum of two numbers |
3 | Write a Java program that takes two numbers and display the product of two numbers |
4 | Write a Java program to print the sum, multiply, subtract, divide and remainder of two numbers |
5 | Write a Java program that takes five numbers as input to calculate and print the average of the numbers |
6 | Write a Java program to swap two variables |
7 | Write a Java program to convert a decimal number to binary numbers |
8 | Write a Java program to convert a binary number to decimal number |
9 | Write a Java program to check whether Java is installed on your computer or not |
10 | Write a Java program and compute the sum of the digits of an integer |
11 | Write a Java program to compare two numbers |
12 | Write a Java program to count the letters, spaces, numbers and other characters of an input string |
13 | Write a Java program to print the ascii value of a given character |
14 | Write a Java program that accepts an integer (n) and computes the value of n+nn+nnn |
15 | Write a Java program to display the system time |
16 | Write a Java program to print the odd numbers from 1 to 20 |
17 | Write a Java program to print the even numbers from 1 to 20 |
18 | Write a Java program to convert a string to an integer |
19 | Write a Java program to convert seconds to hour, minute and seconds |
20 | Write a Java program to compute the sum of the first 100 prime numbers |
21 | Write a Java program to swap the first and last elements of an array and create a new array |
22 | Write a Java program to count the number of even and odd elements in a given array |
23 | Write a Java program to compute the square root of an given integer |
24 | Write a Java program to check if a positive number is a palindrome or not |
25 | Write a Java program to add two numbers without using any arithmetic operators |
26 | Write a Java program to add all the digits of a given positive integer |
27 | Java program to find area of circle |
28 | Java Program to find area of rectangle |
29 | Java Program to find area of triangle |
30 | Java Program to find area of equilateral triangle |
31 | Java Program to find area of rhombus |
32 | Java Program to find area of parallelogram |
33 | Java Program to find area of Prism |
34 | Java Program to find volume of sphere |
35 | Java Program to find volume of cylinder |
36 | Java Program to find volume of cuboid |
37 | Java Program to find volume of cone |
38 | Java program to find surface area of cuboid |
39 | Java program to find surface area of cylinder |
40 | Java program to find surface area of cube |
41 | Java program to calculate average marks |
42 | Java program to check vowel or consonant |
43 | Java program to sum of N numbers |
44 | Java program to find factorial of any number |
45 | Java Program to calculate electricity bill |
46 | Java Program To Calculate CGPA Percentage |
47 | Java Program to calculate compound interest |
48 | Java Program To Calculate Batting Average |
49 | Java Pogram to Calculate Commission Percentage |
50 | Java Pogram To Find Distance Between Two Points |
51 | Java Program To Calculate Power Of Number |
52 | Write a Java program to take three numbers from the user and print the greatest number |
53 | Write a Java program to find the number of days in a month |
54 | Write a Java program to test a number is positive or negative |
55 | Write a Java Program to accept number of week’s day (1-7) and print name of the day |
56 | Write a Java program that takes a year from user and print whether that year is a leap year or not |
57 | Write a Java program to input 5 numbers from keyboard and find their sum and average |
58 | Write a program in Java to display the first 5 natural numbers |
59 | Write a java program to check vowel or consonant |
60 | Write a java program to check vowel or consonant |
61 | Write a Java program to display the n terms of odd natural number and their sum |
62 | Write a Java program to display the multiplication table of a given integer |
63 | Write a Java program that reads an integer and check whether it is negative, zero, or positive |
64 | Write a Java program that reads an integer and check whether it is negative, zero, or positive |
65 | Write a Java program that accepts three numbers and check All numbers are equal or not |
66 | Write a java program that accepts three numbers from the user and check if numbers are in “increasing” or “decreasing” order. |
67 | Write a Java program that determines a student’s grade |
68 | Write a Java program to create a simple calculator |
69 | Write a Java program to concatenate two string |
70 | Write a Java program to convert all characters in a string to lowercase |
71 | Write a Java program to convert all characters in a string to uppercase |
72 | Write a Java program to trim a string(remove whitespaces) |
73 | Write a Java program to get a substring of a given string between two specified positions |
74 | Write a Java program to replace all the ‘d’ characters with ‘f’ characters |
75 | Write a Java program to replace all the ‘d’ characters with ‘f’ characters |
76 | Write a java program to print current date and time in the specified format |
77 | Write a java program to print current date and time in the specified format |
78 | Write a java program to remove a particular character from a string |
79 | Write a java program to remove a particular character from a string |
80 | Write a java program to remove html tags from a string |
81 | Write a java program to remove html tags from a string |
82 | Write a java program to remove html tags from a string |
83 | Write a Java program to find the index of an array element |
84 | Write a Java program to find the index of an array element |
85 | Write a Java program to test if an array contains a specific value |
86 | Write a Java program to find the maximum and minimum value of an array |
87 | Write a Java program to insert an element (specific position) into an array |
88 | Write a Java program to reverse an array of integer values |
89 | Write a Java program to find the common elements between two arrays |
90 | Write a Java program to find the duplicate values of an array of integer values |
91 | Write a Java program to convert an array to ArrayList |
92 | Write a Java program to add two matrices of the same size |
93 | Write a Java program to find second largest number from the array |
94 | Write a Java program to find second lowest number from the array |
95 | Write a Java program to find the number of even and odd integers in a given array of integers |
96 | Write a Java program to get the difference between the largest and smallest values in an array of integers |
97 | Write a Java program to segregate all 0s on left side and all 1s on right side of a given array of 0s and 1s |
98 | Write a Java program to cyclically rotate a given array clockwise by one |
99 | java program to print all unique element in an array |
100 | Write a Java Program to Sort the Array in an Ascending Order |
101 | Write a Java Program to Sort the Array in an Descending Order |
102 | Write a Java Program to Sort Names in an Alphabetical Order |
103 | Write a Java Program to Display Transpose Matrix |
104 | Write a Java Program to Search Key Elements in an Array |
105 | Write a Java Program to Accept the Marks of a Student and find Total Marks and Percentage |
106 | Write a java program to print numbers from 1 to 10 using loop |
107 | Write a java program to calculate the sum of first 10 natural number using loop |
108 | Write a Java program to print multiplication table of given number |
109 | Write a Java program to find the factorial value of any number entered through the keyboard |
110 | Write a Java program that prompts the user to input an integer and then outputs the number with the digits reversed order |
111 | Write a Java program that reads a set of integers, and then prints the sum of the even and odd integers using loop |
112 | Write a Java program that reads a set of integers, and then prints the sum of the even and odd integers using loop |
113 | Write a Java program to calculate HCF of Two given numbers using loop |
114 | Write a Java program to enter the numbers till the user wants and at the end it should display the count of positive, negative and zeros |
115 | Write a Java program to enter the numbers till the user wants and at the end the program should display the largest and smallest numbers entered |
116 | Write a Java program to print out all Armstrong numbers between 1 to 600 using loop |
117 | Write a java program to count total number of notes in entered amount using loop |
118 | Write a Java program to print Fibonacci series of n terms where n is input by user using loop |
119 | Write a java program to calculate the sum of following series where n is input by user |
120 | Write a Java method to compute the average of three numbers |
121 | Write a Java method to find the smallest number among three numbers |
122 | Write a Java method to count all words in a string |
123 | Write a Java method to count all vowels in a string |
124 | Write a Java method to compute the sum of the digits in an integer |
125 | Write a Java method to check whether an year entered by the user is a leap year or not |
126 | Write a Java method to calculate the area of a triangle |
127 | Write a Java method to find the area of a pentagon |
128 | Write a Java method to find number is even number or not |
129 | Write a Java method to check numbers is palindrome number or not |
130 | Write a Java method to displays prime numbers between 1 to 20 |
131 | Write a Java method to find GCD and LCM of Two Numbers |
132 | Write a Java method to find factorial using recursion in java |
133 | Write a Java program to reverse an integer number |
134 | Write a Java program to round a float number to specified decimals |
135 | Write a Java program to round a float number to specified decimals |
136 | Write a Java program to round up the result of integer division |
137 | Write a Java program to convert Roman number to an integer number |
138 | Write a Java program to convert a float value to absolute value |
139 | Write a Java program to accept a float value of number and return a rounded float value |
S.No | Program |
140 | How to convert String to int |
141 | How to convert int to String |
142 | How to convert String to long |
143 | How to convert long to String |
144 | How to convert Decimal to Hex |
145 | How to convert String to float |
146 | How to convert float to String |
147 | How to convert String to double |
148 | How to convert double to String |
149 | How to convert String to Date |
150 | How to convert Date to String |
151 | How to convert String to char |
152 | How to convert char to String |
153 | How to convert String to Object |
154 | How to convert Object to String |
155 | How to convert int to long |
156 | How to convert long to int |
157 | How to convert int to double |
158 | How to convert double to int |
159 | How to convert Octal to Decimal |
160 | How to convert char to int |
161 | How to convert int to char |
162 | How to convert String to boolean |
163 | How to convert boolean to String |
164 | How to convert Date to Timestamp |
165 | How to convert Timestamp to Date |
166 | How to convert Binary to Decimal |
167 | How to convert Decimal to Octal |
168 | How to convert Decimal to Binary |
169 | How to convert Hex to Decimal |
S.No | Program |
170 | Write a Java method to find the smallest number among three numbers. |
171 | Write a Java method to compute the average of three numbers. |
172 | 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. |
173 | Write a Java method to count all the words in a string. |
174 | Write a Java method to compute the future investment value at a given interest rate for a specified number of years. |
175 | Write a Java method to print characters between two characters (i.e. A to P). |
176 | Write a Java method to check whether a string is a valid password. |
177 | Write a Java method to display the current date and time. |
178 | Write a Java method to find all twin prime numbers less than 100. |
179 | Write a Java method to count the number of digits in an integer with the value 2. The integer may be assumed to be non-negative. |
180 | Write a Java method that accepts three integers and checks whether they are consecutive or not. Returns true or false. |
181 | Write a Java method that accepts three integers and returns true if one is the middle point between the other two integers, otherwise false. |
182 | Write a Java method that checks whether all the characters in a given string are vowels (a, e,i,o,u) or not. Return true if each character in the string is a vowel, otherwise return false. |
S.No | Program |
183 | Program to copy all elements of one array into another array |
184 | Program to find the frequency of each element in the array |
185 | Program to left rotate the elements of an array |
186 | Program to print the duplicate elements of an array |
187 | Program to print the elements of an array |
188 | Program to print the elements of an array in reverse order |
189 | Program to print the elements of an array present on even position |
190 | Program to print the elements of an array present on odd position |
191 | Program to print the largest element in an array |
192 | Program to print the smallest element in an array |
193 | Program to print the number of elements present in an array |
194 | Program to print the sum of all the items of the array |
195 | Program to right rotate the elements of an array |
196 | Program to sort the elements of an array in ascending order |
197 | Program to sort the elements of an array in descending order |
198 | Program to Find 3rd Largest Number in an array |
199 | Program to Find 2nd Largest Number in an array |
200 | Program to Find Largest Number in an array |
201 | to Program Find 2nd Smallest Number in an array |
202 | Program to Find Smallest Number in an array |
203 | Program to Remove Duplicate Element in an array |
204 | Program to Print Odd and Even Numbers from an array |
205 | How to Sort an Array in Java |
S.No | Program |
206 | Enter the Matrix of rows and columns entered by the user and print in matrix format |
207 | Program to Add Two Matrices |
208 | Program to Multiply Two Matrices |
209 | Program to subtract the two matrices |
210 | Program to determine whether two matrices are equal |
211 | Program to display the lower triangular matrix |
212 | Program to display the upper triangular matrix |
213 | Program to find the frequency of odd & even numbers in the given matrix |
214 | Program to find the sum of each row and each column of a matrix |
215 | Program to find the transpose of a given matrix |
216 | Program to determine whether a given matrix is an identity matrix |
217 | Program to Transpose matrix |
218 | Program to determine whether a given matrix is a sparse matrix |
S.No | Program |
219 | Program to Check if a String contains only digits? |
220 | Program to perform Deep Copy for String? |
221 | Program to prove String is immutable programmatically? |
222 | Program to remove all occurrences of a given character from input String? |
223 | Program to append the string using StringBuffer class |
224 | Program to insert the string using StringBuffer class |
225 | Program to Add Characters to a String |
226 | Program to Add Characters to a String |
227 | Program to Check Anagram |
228 | Program to check whether a string is a Palindrome |
229 | Program to Convert Enum to String |
230 | Program to Convert String to String Array |
231 | Program to count number of words in a String? |
232 | Program to count the total number of characters in a string |
233 | Program to count the total number of punctuation characters exists in a String |
234 | Program to count the total number of vowels and consonants in a string |
235 | Program to determine whether a given string is palindrome |
236 | Program to determine whether one string is a rotation of another |
237 | Program to divide a string in 'N' equal parts. |
238 | Program to find all subsets of a string |
239 | Program to find all the permutations of a string |
240 | Program to find maximum and minimum occurring character in a string |
241 | Program to find Reverse of the string |
242 | Program to find the duplicate characters in a string |
243 | Program to find the duplicate words in a string |
244 | Program to find the frequency of characters |
245 | Program to find the largest and smallest word in a string |
246 | Program to find the longest repeating sequence in a string |
247 | Program to find the most repeated word in a text file |
248 | Program to find the number of the words in the given text file |
249 | Program to Get a Character From the Given String |
250 | Program to Insert a string into another string |
251 | Program to Iterate Over Characters in String |
252 | Program to Print a New Line in String |
253 | Program to Print even length words |
254 | Program to print smallest and biggest possible palindrome word in a given string |
255 | Program to remove all the white spaces from a string |
256 | Program to replace lower-case characters with upper-case and vice-versa |
257 | Program to replace the spaces of a string with a specific character |
258 | Program to separate the Individual Characters from a String |
259 | Program to Splitting into a number of sub-strings |
260 | Program to swap two string variables without using third or temp variable. |
261 | Program to Swapping Pair of Characters |
262 | Read two String user input and check if first contains second? |
263 | Reserve String without reverse() function |
264 | Reverse String Word by Word |
265 | Write a program to check if two Strings are created with same characters? |
266 | Write a program to find out first non repeated character from input String? |
267 | Create an object StringBuffer class to reverse the string. |
268 | Create an object StringBuffer class to show functionality of insert, append, delete and replace functions. |
S.No | Program |
269 | Write a Java program to create a class called "Person" with a name and age attribute. Create two instances of the "Person" class, set their attributes using the constructor, and print their name and age. |
270 | Write a Java program to create a class called "Dog" with a name and breed attribute. Create two instances of the "Dog" class, set their attributes using the constructor and modify the attributes using the setter methods and print the updated values. |
271 | Write a Java program to create a class called "Rectangle" with width and height attributes. Calculate the area and perimeter of the rectangle. |
272 | Write a Java program to create a class called "Circle" with a radius attribute. You can access and modify this attribute. Calculate the area and circumference of the circle. |
273 | Write a Java program to create a class called "Book" with attributes for title, author, and ISBN, and methods to add and remove books from a collection. |
274 | Write a Java program to create a class called "Employee" with a name, job title, and salary attributes, and methods to calculate and update salary. |
275 | Write a Java program to create a class called "Bank" with a collection of accounts and methods to add and remove accounts, and to deposit and withdraw money. Also define a class called "Account" to maintain account details of a particular customer. |
276 | Write a Java program to create class called "TrafficLight" with attributes for color and duration, and methods to change the color and check for red or green. |
277 | Write a Java program to create a class called "Employee" with a name, salary, and hire date attributes, and a method to calculate years of service. |
278 | Write a Java program to create a class called "Student" with a name, grade, and courses attributes, and methods to add and remove courses. |
279 | Write a Java program to create a class called "Library" with a collection of books and methods to add and remove books. |
280 | Write a Java program to create a class called "Airplane" with a flight number, destination, and departure time attributes, and methods to check flight status and delay. |
281 | Write a Java program to create a class called "Inventory" with a collection of products and methods to add and remove products, and to check for low inventory. |
282 | Write a Java program to create a class called "School" with attributes for students, teachers, and classes, and methods to add and remove students and teachers, and to create classes. |
283 | Write a Java program to create a class called "MusicLibrary" with a collection of songs and methods to add and remove songs, and to play a random song. |
284 | Write a Java program to create a class called "Shape" with abstract methods for calculating area and perimeter, and subclasses for "Rectangle", "Circle", and "Triangle". |
285 | Write a Java program to create a class called "Movie" with attributes for title, director, actors, and reviews, and methods for adding and retrieving reviews. |
286 | Write a Java program to create a class called "Restaurant" with attributes for menu items, prices, and ratings, and methods to add and remove items, and to calculate average rating. |
287 | Write a Java program to create a class with methods to search for flights and hotels, and to book and cancel reservations. |
288 | Create a class showing an example of default constructor. |
289 | Create a class showing an example of parameterized constructor. |
290 | Create a class showing an example of copy constructor. |
291 | Create a class entering the rollno, name and class of the student from user but rollno should be automatically generated as we enter the information of 10 students |
292 | Create a class showing the area of circle and rectangle by method overloading. |
293 | Create a class, entering the command line arguments from the user and show all the arguments as output. |
294 | Write a Java program to create a class called Person with private instance variables name, age. and country. Provide public getter and setter methods to access and modify these variables. |
295 | Write a Java program to create a class called BankAccount with private instance variables accountNumber and balance. Provide public getter and setter methods to access and modify these variables. |
296 | Write a Java program to create a class called Rectangle with private instance variables length and width. Provide public getter and setter methods to access and modify these variables. |
297 | Write a Java program to create a class called Employee with private instance variables employee_id, employee_name, and employee_salary. Provide public getter and setter methods to access and modify the id and name variables, but provide a getter method for the salary variable that returns a formatted string. |
298 | Write a Java program to create a class called Circle with a private instance variable radius. Provide public getter and setter methods to access and modify the radius variable. However, provide two methods called calculateArea() and calculatePerimeter() that return the calculated area and perimeter based on the current radius value. |
299 | Write a Java program to create a class called Car with private instance variables company_name, model_name, year, and mileage. Provide public getter and setter methods to access and modify the company_name, model_name, and year variables. However, only provide a getter method for the mileage variable. |
300 | Write a Java program to create a class called Student with private instance variables student_id, student_name, and grades. Provide public getter and setter methods to access and modify the student_id and student_name variables. However, provide a method called addGrade() that allows adding a grade to the grades variable while performing additional validation. |
S.No | Program |
301 | Write a Java program to create a class called Animal with a method called makeSound(). Create a subclass called Cat that overrides the makeSound() method to bark. |
302 | Write a Java program to create a class called Vehicle with a method called drive(). Create a subclass called Car that overrides the drive() method to print "Repairing a car". |
303 | Write a Java program to create a class called Shape with a method called getArea(). Create a subclass called Rectangle that overrides the getArea() method to calculate the area of a rectangle. |
304 | Write a Java program to create a class called Employee with methods called work() and getSalary(). Create a subclass called HRManager that overrides the work() method and adds a new method called addEmployee(). |
305 | Write a Java program to create a class known as "BankAccount" with methods called deposit() and withdraw(). Create a subclass called SavingsAccount that overrides the withdraw() method to prevent withdrawals if the account balance falls below one hundred. |
306 | Write a Java program to create a class called Animal with a method named move(). Create a subclass called Cheetah that overrides the move() method to run. |
307 | Write a Java program to create a class known as Person with methods called getFirstName() and getLastName(). Create a subclass called Employee that adds a new method named getEmployeeId() and overrides the getLastName() method to include the employee's job title |
308 | Write a Java program to create a class called Shape with methods called getPerimeter() and getArea(). Create a subclass called Circle that overrides the getPerimeter() and getArea() methods to calculate the area and perimeter of a circle. |
309 | Write a Java program to create a vehicle class hierarchy. The base class should be Vehicle, with subclasses Truck, Car and Motorcycle. Each subclass should have properties such as make, model, year, and fuel type. Implement methods for calculating fuel efficiency, distance traveled, and maximum speed. |
310 | Write a Java program that creates a class hierarchy for employees of a company. The base class should be Employee, with subclasses Manager, Developer, and Programmer. Each subclass should have properties such as name, address, salary, and job title. Implement methods for calculating bonuses, generating performance reports, and managing projects. |
311 | Create a program, showing an example of super keyword |
312 | Create a program, showing an example of super function |
313 | Create a program, showing an example of method overriding |
314 | Create a program, showing an example of dynamic method dispatch |
315 | Write a Java program to create an abstract class Animal with an abstract method called sound(). Create subclasses Lion and Tiger that extend the Animal class and implement the sound() method to make a specific sound for each animal. |
316 | Write a Java program to create an abstract class Shape with abstract methods calculateArea() and calculatePerimeter(). Create subclasses Circle and Triangle that extend the Shape class and implement the respective methods to calculate the area and perimeter of each shape. |
317 | Write a Java program to create an abstract class BankAccount with abstract methods deposit() and withdraw(). Create subclasses: SavingsAccount and CurrentAccount that extend the BankAccount class and implement the respective methods to handle deposits and withdrawals for each account type. |
318 | Write a Java program to create an abstract class Animal with abstract methods eat() and sleep(). Create subclasses Lion, Tiger, and Deer that extend the Animal class and implement the eat() and sleep() methods differently based on their specific behavior. |
319 | Write a Java program to create an abstract class Employee with abstract methods calculateSalary() and displayInfo(). Create subclasses Manager and Programmer that extend the Employee class and implement the respective methods to calculate salary and display information for each role. |
320 | Write a Java program to create an abstract class Shape3D with abstract methods calculateVolume() and calculateSurfaceArea(). Create subclasses Sphere and Cube that extend the Shape3D class and implement the respective methods to calculate the volume and surface area of each shape |
321 | Write a Java program to create an abstract class Vehicle with abstract methods startEngine() and stopEngine(). Create subclasses Car and Motorcycle that extend the Vehicle class and implement the respective methods to start and stop the engines for each vehicle type. |
322 | Write a Java program to create an abstract class Person with abstract methods eat() and exercise(). Create subclasses Athlete and LazyPerson that extend the Person class and implement the respective methods to describe how each person eats and exercises. |
323 | Write a Java program to create an abstract class Instrument with abstract methods play() and tune(). Create subclasses for Glockenspiel and Violin that extend the Instrument class and implement the respective methods to play and tune each instrument. |
324 | Write a Java program to create an abstract class Shape2D with abstract methods draw() and resize(). Create subclasses Rectangle and Circle that extend the Shape2D class and implement the respective methods to draw and resize each shape. |
325 | Write a Java program to create an abstract class Bird with abstract methods fly() and makeSound(). Create subclasses Eagle and Hawk that extend the Bird class and implement the respective methods to describe how each bird flies and makes a sound. |
326 | Write a Java program to create an abstract class GeometricShape with abstract methods area() and perimeter(). Create subclasses Triangle and Square that extend the GeometricShape class and implement the respective methods to calculate the area and perimeter of each shape |
S.No | Program |
327 | Write a Java program to create an interface Shape with the getArea() method. Create three classes Rectangle, Circle, and Triangle that implement the Shape interface. Implement the getArea() method for each of the three classes. |
328 | Write a Java program to create a Animal interface with a method called bark() that takes no arguments and returns void. Create a Dog class that implements Animal and overrides speak() to print "Dog is barking". |
329 | Write a Java program to create an interface Flyable with a method called fly_obj(). Create three classes Spacecraft, Airplane, and Helicopter that implement the Flyable interface. Implement the fly_obj() method for each of the three classes. |
330 | Write a Java programming to create a banking system with three classes - Bank, Account, SavingsAccount, and CurrentAccount. The bank should have a list of accounts and methods for adding them. Accounts should be an interface with methods to deposit, withdraw, calculate interest, and view balances. SavingsAccount and CurrentAccount should implement the Account interface and have their own unique methods. |
331 | Write a Java program to create an interface Resizable with methods resizeWidth(int width) and resizeHeight(int height) that allow an object to be resized. Create a class Rectangle that implements the Resizable interface and implements the resize methods. |
332 | Write a Java program to create an interface Drawable with a method draw() that takes no arguments and returns void. Create three classes Circle, Rectangle, and Triangle that implement the Drawable interface and override the draw() method to draw their respective shapes. |
333 | Write a Java program to create an interface Sortable with a method sort() that sorts an array of integers in ascending order. Create two classes BubbleSort and SelectionSort that implement the Sortable interface and provide their own implementations of the sort() method. |
334 | Write a Java program to create an interface Playable with a method play() that takes no arguments and returns void. Create three classes Football, Volleyball, and Basketball that implement the Playable interface and override the play() method to play the respective sports. |
335 | Write a Java program to create an interface Searchable with a method search(String keyword) that searches for a given keyword in a text document. Create two classes Document and WebPage that implement the Searchable interface and provide their own implementations of the search() method. |
336 | Write a Java program to create an interface Encryptable with methods encrypt (String data) and decrypt (String encryptedData) that define encryption and decryption operations. Create two classes AES and RSA that implement the Encryptable interface and provide their own encryption and decryption algorithms. |
337 | Write a Java program to create an interface Sortable with a method sort (int[] array) that sorts an array of integers in descending order. Create two classes QuickSort and MergeSort that implement the Sortable interface and provide their own implementations of the sort() method. |
S.No | Program |
338 | Enter the character from user using InputStreamReader |
339 | Enter the string from user using BufferedStreamReader |
340 | Enter the integer from user using Scanner class |
341 | Enter the float from user using Scanner class |
342 | Enter the double from user using Scanner class |
343 | Enter the boolean from user using Scanner class |
344 | Enter the short integer from user using Scanner class |
345 | Enter the long integer from user using Scanner class |
346 | Get all characters from the file and display on the screen |
347 | Get all characters from the file, count number of lines, words, characters and display on the screen |
S.No | Program |
348 | Create a Java program to access the java.util.Date class through import keyword and print the current date of the system. |
349 | Create a Java program to access the java.util.Date class through qualified way and print the current date of the system. |
350 | Create a Java program to access the java.util.Date class through import keyword and print the current date of the system but inherit the Date class. |
351 | Create a Java program to access the java.util.Date class through qualified way and print the current date of the system but inherit the Date class. |
352 | Create a Java program to create a package with multiple default classes. |
353 | Create a Java program to create a package with 4 public classes, create the object in another file and call the function created in those classes. |
354 | Write a Java program to perform employee payroll processing using packages. In the java file, Emp.java creates a package employee and creates a class Emp. Declare the variables name,empid, category, bpay, hra, da, npay, pf, grosspay, incometax, and allowance. Calculate the values in methods. Create another java file Emppay.java. Create an object e to call the methods to perform and print values. |
355 | Create a Java program to create a package with public class and protected members to be accessed in another class. |
356 | Create a Java program to create a nested package i.e. c4.sample with public class and protected members to be accessed in another class. |
357 | Create a Java program to create a package with public class and public members to be accessed in another class. |
S.No | Program |
358 | Write a Java program that throws an exception and catch it using a try-catch block. |
359 | Write a Java program to create a method that takes an integer as a parameter and throws an exception if the number is odd. |
360 | Write a Java program to create a method that reads a file and throws an exception if the file is not found. |
361 | Write a Java program that reads a list of numbers from a file and throws an exception if any of the numbers are positive |
362 | Write a Java program that reads a file and throws an exception if the file is empty. |
363 | Write a Java program that reads a list of integers from the user and throws an exception if any numbers are duplicates. |
364 | Write a Java program to create a method that takes a string as input and throws an exception if the string does not contain vowels. |
365 | Write a Java program to connect the Java API to Database, if connection not successful then throw an exception. |
366 | Write a Java program to manage the driver with path, username and password, if not successful then throw an exception. |
367 | Write a Java program to throw the SQL Query, insert, delete, update, if not successful then throw an exception. |
368 | Write a Java program to show an example of throws Keyword. |
369 | Write a Java program to show an example of multiple catch. |
370 | Write a Java program to show an example of nested try block. |
S.No | Program |
371 | Java Program to Display Some Text in the Frame using Labels |
372 | Java Program to Create Text Area and Password Field |
373 | Java Program to Create a Button and Display Image in the Frame when Clicked |
374 | Java Program to Create 2 Radio Buttons and Display Selected Button Label |
375 | Java Program to Handle KeyBoardEvent |
376 | Java Program to Handle MouseEvent |
377 | Java Program to Get and Set State and Get Label of a Check Box |
378 | Java Program to Create Check Boxes and Radio Buttons |
379 | Java Program to Create and Switch between Frames using Buttons |
380 | Java Program to Create and Set Border to Push Buttons |
381 | Java Program to Create a List Box to Select Multiple Items and Display it in the Frame |
382 | Java Program to Display a Message in a New Frame |
383 | Java Program to Close the Frame using WindowAdapter Class |
384 | Java Program to Check Which Fonts are Available in a Local System |
385 | Java Program to Display Text in Different Fonts |
386 | Java Program to Change Frame Background Color as Cyan |
387 | Java Program to Change the Applet Background Colour when Button Clicked |
388 | Java Program to Display Several Dots on the Screen Continuously |
389 | Java Program to Validate the TextField for only entering numbers using KeyListener |
390 | Java Program to Validate the TextField for only entering email id using KeyAdapter |
S.No | Program |
391 | Create an applet showing the string "Hello World" which is embedded in the HTML page. |
392 | Create an applet showing the string "Hello World" which is executed by an appletviewer. |
293 | Create an applet in Java to draw a circle. |
394 | Create an applet in Java to draw a polygon. |
395 | Create an applet in Java to draw a rectangle. |
396 | Create an applet in Java to draw a square. |
397 | Create an applet in Java to draw a 4 concentric circles. |
398 | Create an applet in Java to draw a line. |
399 | Create an applet in Java to draw a oval. |
400 | Create an applet in Java to draw a arc. |
401 | Create an applet in Java to change the background color. |
402 | Create an applet in Java to draw rounded rectangle. |
403 | Create an applet in Java to set font. |
404 | Create an applet to display a digital clock. |
405 | Java Program to Draw a Smiling Face using Graphics Class Methods. |
S.No | Program |
406 | Write a Java program to create a basic Java thread that prints "Hello, World!" when executed. |
407 | Write a Java program that creates two threads to find and print even and odd numbers from 1 to 20. |
408 | Write a Java program that sorts an array of integers using multiple threads. |
409 | Write a Java program that performs matrix multiplication using multiple threads. |
410 | Write a Java program that calculates the sum of all prime numbers up to a given limit using multiple threads. |
411 | Write a Java program to implement a concurrent web crawler that crawls multiple websites simultaneously using threads. |
412 | Write a Java program that creates a bank account with concurrent deposits and withdrawals using threads. |
413 | Create the program to create multiple threads by using Runnbale interface |
414 | Create the program to create multiple threads by using Thread class |
415 | Create the program to create multiple threads, set its name and its priority. |
416 | Create the program to create multiple threads, show an example of synchronization keyword |
417 | Create the program to create multiple threads, show an example of notify, notifyall, wait, resume, sleep methods. |
418 | Create the program to create multiple threads, show an example of join and yield methods. |
S.No | Program |
419 | Create a simple AWT application that displays a button with FlowLayout manager. |
420 | Create a simple AWT application that displays a button with Custom Layout. |
421 | Create a simple AWT application that displays multiple buttons with BorderLayout manager (North, East, West, South, Center). |
422 | Create a simple AWT application that displays a TextField with FlowLayout manager. |
423 | Create a simple AWT application that displays a TextField with Custom Layout. |
424 | Create a simple AWT application that displays a Checkbox with FlowLayout manager. |
425 | Create a simple AWT application that displays a Checkbox with Custom Layout. |
426 | Create a simple AWT application that displays a Label with FlowLayout manager. |
427 | Create a simple AWT application that displays a Label with Custom Layout. |
428 | Create a simple AWT application that displays a Choice with FlowLayout manager. |
429 | Create a simple AWT application that displays a Choice with Custom Layout. |
430 | Create a simple AWT application that displays a CheckboxGroup with FlowLayout manager. |
431 | Create a simple AWT application that displays a CheckboxGroup with Custom Layout. |
432 | Create a simple AWT application that displays a List with FlowLayout manager. |
433 | Create a simple AWT application that displays a List with Custom Layout. |
434 | Create a simple AWT application that displays a TextArea with FlowLayout manager. |
345 | Create a simple AWT application that displays a TextArea with Custom Layout. |
346 | Create a simple AWT application design a calculator that displays buttons, TextField with GridLayout manager. |
S.No | Program |
437 | Create the connection with MySQL Database and manage the driver. |
438 | Create the table in the database from Java API. |
439 | Insert the row in the table in the database from Java API. |
440 | Update the row in the table in the database from Java API. |
441 | Delete the row in the table in the database from Java API. |
442 | Select multiple rows from the database table in Java API and show the result on the screen. |
443 | Create a Scrollable Readonly Resultset and ask the row number from the user and display that row on the screen. |
444 | Create a Scrollable Updateable Resultset and insert a new row, update an existing row and delete the row from Resultset and also the changes should be made to the database also. The values should be inserted, updated and deleted by the user only. |
445 | Create a Java Program to show, insert, update, delete of the table in Java API through PreparedStatement. |