TOP 100 CORE JAVA PRACTICE QUESTIONS
✅TOP 100 CORE JAVA PRACTICE QUESTIONS
Here are top 100 core java practical questions mostly asked in interview.
Conditional Statements
- Write a program to check if a number is positive, negative, or zero.
- Write a program to find the largest of three numbers.
- Write a program to check if a number is even or odd.
- Write a program to check if a character is a vowel or consonant.
- Write a program to check if a year is a leap year or not.
- Write a program to check if a number is prime.
- Write a program to find the greatest of three numbers using the ternary operator.
- Write a program to check if a number is a palindrome.
- Write a program to check if a string is a palindrome.
- Write a program to print the day of the week based on a number (1-7).
Patterns
- Write a program to print a pyramid pattern.
- Write a program to print a reverse pyramid pattern.
- Write a program to print a right-angled triangle pattern.
- Write a program to print an inverted right-angled triangle pattern.
- Write a program to print a diamond pattern.
- Write a program to print a hollow square pattern.
- Write a program to print a hollow triangle pattern.
- Write a program to print a Pascal's triangle.
- Write a program to print a Floyd's triangle.
- Write a program to print a butterfly pattern.
Series
- Write a program to print the Fibonacci series up to a given number.
- Write a program to print the factorial of a number.
- Write a program to print the sum of the first n natural numbers.
- Write a program to print the sum of the first n odd numbers.
- Write a program to print the sum of the first n even numbers.
- Write a program to print the prime numbers in a given range.
- Write a program to print the sum of digits of a number.
- Write a program to print the Armstrong numbers in a given range.
- Write a program to print the perfect numbers in a given range.
- Write a program to print the sum of the series 1 - 2 + 3 - 4 + ... + n.
Combination of Patterns/Series/OOP Concepts
- Write a program to print a pyramid pattern of prime numbers.
- Write a program to print a right-angled triangle pattern of Fibonacci numbers.
- Write a program to print the factorial of each number in a given range using recursion.
- Write a program to check if a given number is a palindrome using a method.
- Write a program to print a diamond pattern using the sum of digits of numbers.
- Write a program to print a pattern of Armstrong numbers.
- Write a program to print a combination of Pascal's triangle and prime numbers.
- Write a program to print the sum of the first n prime numbers using a method.
- Write a program to print the sum of the series 1 - 2 + 3 - 4 + ... + n using a method.
- Write a program to print the factorial of numbers in a pattern.
this Keyword
- Write a program to demonstrate the use of the
thiskeyword in constructors. - Write a program to demonstrate the use of the
thiskeyword to refer to instance variables. - Write a program to demonstrate the use of the
thiskeyword to invoke current class methods. - Write a program to demonstrate the use of the
thiskeyword to return the current class instance. - Write a program to demonstrate the use of the
thiskeyword in method chaining. - Write a program to demonstrate the use of the
thiskeyword to invoke a constructor. - Write a program to demonstrate the use of the
thiskeyword to pass an argument in the constructor call. - Write a program to demonstrate the use of the
thiskeyword to resolve shadowing problem. - Write a program to demonstrate the use of the
thiskeyword in setter methods. - Write a program to demonstrate the use of the
thiskeyword to access class members.
super Keyword
- Write a program to demonstrate the use of the
superkeyword to access superclass variables. - Write a program to demonstrate the use of the
superkeyword to invoke superclass methods. - Write a program to demonstrate the use of the
superkeyword to invoke superclass constructors. - Write a program to demonstrate the use of the
superkeyword to access superclass methods in a method overriding scenario. - Write a program to demonstrate the use of the
superkeyword in constructor chaining. - Write a program to demonstrate the use of the
superkeyword to call superclass static methods. - Write a program to demonstrate the use of the
superkeyword in an inheritance hierarchy with multiple levels. - Write a program to demonstrate the use of the
superkeyword to access superclass fields when they are shadowed by subclass fields. - Write a program to demonstrate the use of the
superkeyword in the context of a superclass reference. - Write a program to demonstrate the use of the
superkeyword in method overriding with return types.
final Keyword
- Write a program to demonstrate the use of the
finalkeyword with variables. - Write a program to demonstrate the use of the
finalkeyword with methods. - Write a program to demonstrate the use of the
finalkeyword with classes. - Write a program to demonstrate the use of the
finalkeyword to create immutable objects. - Write a program to demonstrate the use of the
finalkeyword in method parameters. - Write a program to demonstrate the use of the
finalkeyword with static variables. - Write a program to demonstrate the use of the
finalkeyword with instance variables. - Write a program to demonstrate the use of the
finalkeyword in nested classes. - Write a program to demonstrate the use of the
finalkeyword in anonymous classes. - Write a program to demonstrate the use of the
finalkeyword with local variables in a method.
Methods
- Write a program to demonstrate method overloading.
- Write a program to demonstrate method overriding.
- Write a program to demonstrate the use of static methods.
- Write a program to demonstrate the use of instance methods.
- Write a program to demonstrate the use of recursive methods.
- Write a program to demonstrate the use of the
mainmethod. - Write a program to demonstrate the use of the
valueOfmethod in theStringclass. - Write a program to demonstrate the use of the
compareTomethod in theStringclass. - Write a program to demonstrate the use of the
substringmethod in theStringclass. - Write a program to demonstrate the use of the
lengthmethod in theStringclass.
Miscellaneous
- Write a program to demonstrate the use of the
Mathclass methods. - Write a program to demonstrate the use of the
Arraysclass methods. - Write a program to demonstrate the use of the
StringBuilderclass methods. - Write a program to demonstrate the use of the
StringBufferclass methods. - Write a program to demonstrate the use of the
Scannerclass methods. - Write a program to demonstrate the use of the
Randomclass methods. - Write a program to demonstrate the use of the
Systemclass methods. - Write a program to demonstrate the use of the
Localeclass methods. - Write a program to demonstrate the use of the
Dateclass methods. - Write a program to demonstrate the use of the
Calendarclass methods.
Advanced
- Write a program to demonstrate the use of nested loops.
- Write a program to demonstrate the use of the
switchstatement. - Write a program to demonstrate the use of labeled
breakandcontinue. - Write a program to demonstrate the use of exception handling using
try,catch,finally. - Write a program to demonstrate the use of custom exceptions.
- Write a program to demonstrate the use of
assertstatement. - Write a program to demonstrate file reading and writing using
FileReaderandFileWriter. - Write a program to demonstrate file reading and writing using
BufferedReaderandBufferedWriter. - Write a program to demonstrate reading and writing binary data using
FileInputStreamandFileOutputStream. - Write a program to demonstrate reading and writing objects using
ObjectInputStreamandObjectOutputStream.
These questions cover a wide range of core Java concepts and provide practical exposure to various topics.

