5_and_6
5_and_6
3. What are the different layouts in the Swing package? Explain any two.
6. What is the role of constructors in Java? Explain constructor overloading with examples.
3. Explain the keywords try, catch, throw, throws, and finally in exception handling.
1. Write a Java program to create a button using the default layout and display it on a frame.
2. Write a multithreading program to print odd and even numbers using two threads.
3. Write a Java program to demonstrate the use of try, catch, and finally with exception handling.
4. Write a Java program to calculate the sum of numbers using a recursive method.
5. Write a Java program to print the current date using the java.util package.
1. Write a Java program to demonstrate the difference between String and StringBuffer by
3. Create a Java Swing GUI application with two buttons and handle their click events.
5. Write a user-defined exception program that throws an exception when a number is negative.