Java Lab
Java Lab
Java Lab
tech CSE II Sem JAVA LAB Total no of weeks=14 WEEK 1: OOPS and COMMAND LINE ARGUMENTS
1. Write a java program to display a welcome message. 2. Write a java program that prints all real solutions to the quadratic equation ax2+bx+c=0. Read in a, b, c and use the quadratic formula. If the discriminant b2-4ac is negative, display a message stating that there are no real solutions. 3. Write a java program that prompts the user for an integer and then prints out all prime numbers up to that integer. 4. The Fibonacci sequence is defined by the following rule: The first two values in the sequence are 1 and 1. Every subsequent value is the sum of the two values preceding it. Write a java program that uses both recursive and non recursive functions to print the nth value in the Fibonacci sequence. 5. Write a java program to multiply two given matrices.
5. Write a java program that illustrates how run-time polymorphism is achieved. 6. Write a java program to implement INNER classes.
WEEK 5: IO PACKAGES
1. Write a java program to find the factorial of a given number (use BUFFERED reader class). 2. Write a java program to copy the contents of one file into another file. 3. Write a java program that reads on file name from the user then displays information about whether the file exists, whether the file is readable/writable, the type of file and the length of the file in bytes and display the content of the file using FILE INPUT STREAM class. 4. Write a java program that displays the number of characters, lines and words in a text/text file. 5. Write a java program to use data input and output stream classes.
B) Write a java program to implement a queue using user defined exception handling(also make use of throw, throws).