Core Java Interview Questions
Core Java Interview Questions
Core Java Interview Questions
QUESTIONS
1. Write a java program to reverse the string?
import java.util.*;
class ReverseString
{
public static void main(String args[])
{
String original, reverse = "";
Scanner in = new Scanner(System.in);
int length = original.length();
for (int i = length - 1 ; i >= 0 ; i--)
reverse = reverse + original.charAt(i);
2. There is a variable declared inside the Interface. Can we change the value of the variable?
1. Write code to filter duplicate elements from an array and print as a list?
2. Write code to sort the list of strings using Java collection?
3. Write a function to reverse a number in Java?
4. Write a method to check prime no. in Java?
5. Write a Java program to find out the first two max values from an array?
6. Write a Java program to find the longest substring from a given string which doesn’t
contain any duplicate characters?
7. Write Java code to get rid of multiple spaces from a string?
8. Write Java code to identify a number as Palindrome?
9. Write Java code to swap two numbers without using a temporary variable?
10. Write a Java program to demonstrate string reverse with and without StringBuffer class?