All Java Topics 10 Questions Each
All Java Topics 10 Questions Each
1. Create a class named Student with fields name, age and rollNumber.
10. Create a class Book with static variable for total books.
Methods
1. Write a method to calculate the factorial of a number.
10. Create a method to find the greatest common divisor (GCD) of two numbers.
Method Overloading
1. Create overloaded methods for addition with 2 and 3 integers.
3. Implement hierarchical inheritance with one base and multiple derived classes.
10. Create a base class Person and derived classes Student and Teacher.
3. Create a parent class Shape with draw method and override it.
Method Overriding
1. Override a method from base class in derived class.
Types of Variables
1. Declare and use a local variable.
Scope of Variables
1. Demonstrate variable inside a method.
Abstract Classes
1. Create an abstract class and extend it.
Interfaces
1. Define a simple interface and implement it.
Encapsulation
1. Create private variables with public getter and setter.
Event Handling
1. Handle button click using ActionListener.
Threads
1. Create thread using Thread class.
Creating Threads
1. Extend Thread class and override run().