Java Lab Assignments
Java Lab Assignments
2 A) Write a Java program to print the prime numbers from 1-100. A) Write a Java program to print the prime numbers from 1-100. A) Write a Java program to print the prime numbers from 1-100. A) Write a Java program to print the prime numbers from 1-100. A) Write a Java program to print the prime numbers from 1-100. A) Write a Java program to print the prime numbers from 1-100. A) Write a Java program to print the prime numbers from 1-100. A) Write a Java program to print the prime numbers from 1-100. A) Write a Java program to print the prime numbers from 1-100. A) Write a Java program to print the prime numbers from 1-100.
B) Write a Java program to check and display message whether the entered three digit number is Armstrong number. (Armstrong Number e.g. 1*1*1+5*5*5+3*3*3=153) B)
3 Write a Java program to check and display message whether the entered three digit number is Armstrong number. (Armstrong Number e.g. 1*1*1+5*5*5+3*3*3=153) B) Write a Java program to check and display message whether the entered three digit number is Armstrong number. (Armstrong Number e.g. 1*1*1+5*5*5+3*3*3=153) B) Write a Java program to check and display message whether the entered three digit number is Armstrong number. (Armstrong Number e.g. 1*1*1+5*5*5+3*3*3=153) B) Write a Java program to check and display message whether the entered three digit number is Armstrong number. (Armstrong Number e.g. 1*1*1+5*5*5+3*3*3=153) B) Write a Java program to check and display message whether the entered three digit number is Armstrong number. (Armstrong Number e.g. 1*1*1+5*5*5+3*3*3=153) B) Write a Java program to check and display message whether the entered three digit number is Armstrong number. (Armstrong Number e.g. 1*1*1+5*5*5+3*3*3=153) B) Write a Java program to check and display message whether the entered three digit number is Armstrong number. (Armstrong Number e.g. 1*1*1+5*5*5+3*3*3=153) B) Write a Java program to check and display message whether the entered three digit number is Armstrong number. (Armstrong Number e.g. 1*1*1+5*5*5+3*3*3=153) B) Write a Java program to check and display message whether the entered three digit number is Armstrong number. (Armstrong Number e.g. 1*1*1+5*5*5+3*3*3=153) C)
4 Write a program to evaluate 24 + 99 + tan-1 (4) + log e 10 C) Write a program to evaluate 24 + 99 + tan-1 (4) + log e 10 C) Write a program to evaluate 24 + 99 + tan-1 (4) + log e 10 C) Write a program to evaluate 24 + 99 + tan-1 (4) + log e 10 C) Write a program to evaluate 24 + 99 + tan-1 (4) + log e 10 C) Write a program to evaluate 24 + 99 + tan-1 (4) + log e 10 C) Write a program to evaluate 24 + 99 + tan-1 (4) + log e 10 C) Write a program to evaluate 24 + 99 + tan-1 (4) + log e 10 C) Write a program to evaluate 24 + 99 + tan-1 (4) + log e 10 C) Write a program to evaluate 24 + 99 + tan-1 (4) + log e 10 C) Write a program to evaluate 24 + 99 + tan-1 (4) + log e 10
C)
5 Write a program to evaluate 24 + 99 + tan-1 (4) + log e 10 C) Write a program to evaluate 24 + 99 + tan-1 (4) + log e 10 C) Write a program to evaluate 24 + 99 + tan-1 (4) + log e 10 C) Write a program to evaluate 24 + 99 + tan-1 (4) + log e 10 C) Write a program to evaluate 24 + 99 + tan-1 (4) + log e 10 C) Write a program to evaluate 24 + 99 + tan-1 (4) + log e 10 C) Write a program to evaluate 24 + 99 + tan-1 (4) + log e 10 C) Write a program to evaluate 24 + 99 + tan-1 (4) + log e 10 C) Write a program to evaluate 24 + 99 + tan-1 (4) + log e 10 C) Write a program to evaluate 24 + 99 + tan-1 (4) + log e 10
D)
6 Write a Java program to find the factorial of a number. 5! = 5*4*3*2*1. D) Write a Java program to find the factorial of a number. 5! = 5*4*3*2*1. D) Write a Java program to find the factorial of a number. 5! = 5*4*3*2*1. D) Write a Java program to find the factorial of a number. 5! = 5*4*3*2*1. D) Write a Java program to find the factorial of a number. 5! = 5*4*3*2*1. D) Write a Java program to find the factorial of a number. 5! = 5*4*3*2*1. D) Write a Java program to find the factorial of a number. 5! = 5*4*3*2*1. D) Write a Java program to find the factorial of a number. 5! = 5*4*3*2*1. D) Write a Java program to find the factorial of a number. 5! = 5*4*3*2*1. D) Write a Java program to find the factorial of a number. 5! = 5*4*3*2*1.
7 E) Write a program to display the reverse of a number. Also write a program to print the reverse of a string. Hint: Use charAt() for printing a character E) Write a program to display the reverse of a number. Also write a program to print the reverse of a string. Hint: Use charAt() for printing a character E) Write a program to display the reverse of a number. Also write a program to print the reverse of a string. Hint: Use charAt() for printing a character E) Write a program to display the reverse of a number. Also write a program to print the reverse of a string. Hint: Use charAt() for printing a character E) Write a program to display the reverse of a number. Also write a program to print the reverse of a string. Hint: Use charAt() for printing a character E) Write a program to display the reverse of a number. Also write a program to print the reverse of a string. Hint: Use charAt() for printing a character E) Write a program to display the reverse of a number. Also write a program to print the reverse of a string. Hint: Use charAt() for printing a character E) Write a program to display the reverse of a number. Also write a program to print the reverse of a string. Hint: Use charAt() for printing a character E) Write a program to display the reverse of a number. Also write a program to print the reverse of a string. Hint: Use charAt() for printing a character
8 E) Write a program to display the reverse of a number. Also write a program to print the reverse of a string. Hint: Use charAt() for printing a character E) Write a program to display the reverse of a number. Also write a program to print the reverse of a string. Hint: Use charAt() for printing a character E) Write a program to display the reverse of a number. Also write a program to print the reverse of a string. Hint: Use charAt() for printing a character F) Write a program for Fibonacci series. F) Write a program for Fibonacci series. F) Write a program for Fibonacci series. F) Write a program for Fibonacci series. F) Write a program for Fibonacci series. F) Write a program for Fibonacci series. F) Write a program for Fibonacci series. F) Write a program for Fibonacci series. F) Write a program for Fibonacci series. F) Write a program for Fibonacci series. G) Write a standalone code in Java to print odd numbers in the following manner. Program will ask a user about the input, to enter how many odd numbers to print. If user enters 20, it will print first 20 odd numbers. G) Write a standalone code in Java to print odd numbers in the following manner. Program will ask a user about the input, to enter how many odd numbers to print. If user enters 20, it will print first 20 odd numbers. G) Write a standalone code in Java to print odd numbers in the following manner. Program will ask a user about the input, to enter how many odd numbers to print. If user enters 20, it will print first 20 odd numbers.
9 G) Write a standalone code in Java to print odd numbers in the following manner. Program will ask a user about the input, to enter how many odd numbers to print. If user enters 20, it will print first 20 odd numbers. G) Write a standalone code in Java to print odd numbers in the following manner. Program will ask a user about the input, to enter how many odd numbers to print. If user enters 20, it will print first 20 odd numbers. H) Write a program to sort an array of strings in ascending alphabetical order. H) Write a program to sort an array of strings in ascending alphabetical order. H) Write a program to sort an array of strings in ascending alphabetical order. H) Write a program to sort an array of strings in ascending alphabetical order. H) Write a program to sort an array of strings in ascending alphabetical order. H) Write a program to sort an array of strings in ascending alphabetical order. H) Write a program to sort an array of strings in ascending alphabetical order. H) Write a program to sort an array of strings in ascending alphabetical order. H) Write a program to sort an array of strings in ascending alphabetical order. H) Write a program to sort an array of strings in ascending alphabetical order.
10 I) Write a Java program to arrange Neeta, Seeta, Mohan, Ashim, Shama, Geeta in descending order. I) Write a Java program to arrange Neeta, Seeta, Mohan, Ashim, Shama, Geeta in descending order. I) Write a Java program to arrange Neeta, Seeta, Mohan, Ashim, Shama, Geeta in descending order. I) Write a Java program to arrange Neeta, Seeta, Mohan, Ashim, Shama, Geeta in descending order. I) Write a Java program to arrange Neeta, Seeta, Mohan, Ashim, Shama, Geeta in descending order. I) Write a Java program to arrange Neeta, Seeta, Mohan, Ashim, Shama, Geeta in descending order. I) Write a Java program to arrange Neeta, Seeta, Mohan, Ashim, Shama, Geeta in descending order. I) Write a Java program to arrange Neeta, Seeta, Mohan, Ashim, Shama, Geeta in descending order. I) Write a Java program to arrange Neeta, Seeta, Mohan, Ashim, Shama, Geeta in descending order. I) Write a Java program to arrange Neeta, Seeta, Mohan, Ashim, Shama, Geeta in descending order. J) Create a package Book containing Book name and Publisher name. Call Book name and Publisher name from the package. J) Create a package Book containing Book name and Publisher name. Call Book name and Publisher name from the package. J) Create a package Book containing Book name and Publisher name. Call Book name and Publisher name from the package.
11 J) Create a package Book containing Book name and Publisher name. Call Book name and Publisher name from the package. J) Create a package Book containing Book name and Publisher name. Call Book name and Publisher name from the package. J) Create a package Book containing Book name and Publisher name. Call Book name and Publisher name from the package. J) Create a package Book containing Book name and Publisher name. Call Book name and Publisher name from the package. J) Create a package Book containing Book name and Publisher name. Call Book name and Publisher name from the package. J) Create a package Book containing Book name and Publisher name. Call Book name and Publisher name from the package. J) Create a package Book containing Book name and Publisher name. Call Book name and Publisher name from the package.
K) Program to Calculate Area of Squares and Rectangle using Constructors K) Program to Calculate Area of Squares and Rectangle using Constructors K) Program to Calculate Area of Squares and Rectangle using Constructors K) Program to Calculate Area of Squares and Rectangle using Constructors K) Program to Calculate Area of Squares and Rectangle using Constructors K) Program to Calculate Area of Squares and Rectangle using Constructors K) Program to Calculate Area of Squares and Rectangle using Constructors K) Program to Calculate Area of Squares and Rectangle using Constructors
12
K) Program to Calculate Area of Squares and Rectangle using Constructors K) Program to Calculate Area of Squares and Rectangle using Constructors L) Program to Calculate Area of Squares and Rectangle using Method Overloading. L) Program to Calculate Area of Squares and Rectangle using Method Overloading. L) Program to Calculate Area of Squares and Rectangle using Method Overloading. L) Program to Calculate Area of Squares and Rectangle using Method Overloading. L) Program to Calculate Area of Squares and Rectangle using Method Overloading. L) Program to Calculate Area of Squares and Rectangle using Method Overloading. L) Program to Calculate Area of Squares and Rectangle using Method Overloading. L) Program to Calculate Area of Squares and Rectangle using Method Overloading. L) Program to Calculate Area of Squares and Rectangle using Method Overloading. L) Program to Calculate Area of Squares and Rectangle using Method Overloading. L) Program to Calculate Area of Squares and Rectangle using Method Overloading. L) Program to Calculate Area of Squares and Rectangle using Method Overloading.