0% found this document useful (0 votes)
2 views2 pages

Java Programming Lab Exercises Guide

The document consists of a series of journal questions designed for a lab on Java programming, covering various topics such as control structures, classes, and object-oriented programming. It includes tasks like finding the largest of three numbers, checking leap years, implementing a basic calculator, and creating classes for students and employees. The questions encourage the implementation of algorithms, data structures, and Java concepts through practical coding exercises.

Uploaded by

andhapaisaaa
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Java Programming Lab Exercises Guide

The document consists of a series of journal questions designed for a lab on Java programming, covering various topics such as control structures, classes, and object-oriented programming. It includes tasks like finding the largest of three numbers, checking leap years, implementing a basic calculator, and creating classes for students and employees. The questions encourage the implementation of algorithms, data structures, and Java concepts through practical coding exercises.

Uploaded by

andhapaisaaa
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Lab on Java Programming

Journal Questions

Q.1 Write a Java program to find the largest of three numbers using if-else.
Q.2 Write a Java program to check whether a given year is a leap year or not.
Q.3 Write a Java program to classify a student’s grade based on marks using if-
else.
Q.4 Write a Java program to perform a basic calculator using switch-case.
Q.5 Write a Java program to check whether a given character is a vowel or
consonant using switch-case.
Q.6 Write a Java program to print the factorial of a given number.
Q.7 Write a Java program to print the Fibonacci series up to N terms.
Q.8 Write a Java program to reverse a given number using while loop.
Q.9 Write a Java program to check whether a number is prime or not.
Q.10 Write a Java program to print all even numbers from 1 to 100.
Q.11 Write a Java program to create a class Student with attributes: rollNo, name,
and marks. Create objects of the class and display student details. Include a method
to calculate grade based on marks.
Q.12 Create a class Rectangle with attributes length and width. Use a
parameterized constructor to initialize the values. Write methods to calculate area
and perimeter of the rectangle. Display the results using an object of the class.
Q.13 Write a program to create a class Book with attributes: title, author, and price.
Include a default constructor and a parameterized constructor. Create objects using
both constructors and display book details.
Q. 14 Design a Java program to:
 Accept an array of integers from the user.
 Implement a method to sort the array in ascending order without using built-
in sort functions.
 Implement a method to search for a given element using linear search and
binary search.
 Display the sorted array and the result of the searches.

Q. 15 Design a Java program to:

 Create a two-dimensional integer array.


 Traverse the array and display its elements in matrix form.
 Implement a method to search for a specific value in the 2D array and return its position.
 Handle the case when the element is not found.

Q.16 Design a Java program to:

 Take two input strings from the user.


 Perform and display results for the following operations: length, concatenation,
comparison (case-sensitive and case-insensitive), substring extraction, and replacement of
characters.
 Include methods for each operation.

Q.17 Design a Java program to: Demonstrate the concept of the String Literal Pool
in Java. Create strings using literals and the new keyword. Compare the strings
using == and .equals() and explain the output with comments in the code.
Q.18 Create a class Employee with attributes: empId, name, and salary. Create a
subclass Manager that inherits from Employee and has an additional attribute
department. Display details of both Employee and Manager using objects.
Q.19 Create a class Person with name and age. Create a subclass Student with
rollNo and marks. Create another subclass GraduateStudent with degree and
yearOfPassing. Display complete details using objects.

You might also like