Core Java Tutorial & Interview questions

Core Java Beginner Tutorials:

  1. Program to check given input number is even or odd
  2. Swap two numbers without using third or temporary variable
  3. Swap two numbers using third or temporary variable 
  4. Find area & perimeter of a square
  5. Calculate area & circumference of circle
  6. Find area & perimeter of rectangle
  7. Find area of triangle using base & height
  8. Find area of triangle (three sides) using hero formula
  9. Convert String variable to Integer in java
  10. Convert String object to lower case & upper case
  11. Reverse each word of a string using StringBuilder
  12. Reverse string word by word in java (stack/StringBuilder)
  13. Join or concatenate or combine multiple strings in java (example)
  14. Java API, recursive & iterative algorithm to reverse string
  15. Program to reverse number in java – iterative method
  16. Find number of consecutive 1’s in a binary number
  17. Write or redirect standard output error stream to a file
  18. Write or redirect console output to a file & again reset to standard output
  19. Program to convert binary number to decimal 
  20. Convert decimal number to binary 
  21. Convert hexadecimal to decimal
  22. Convert decimal to hexadecimal
  23. Find LCM of two numbers using GCD
  24. Check whether given integer number is prime or not
  25. GCD of two numbers Euclidean algorithm in java (iterative/ recursive)
  26. Check given number is palindrome
  27. Find factorial of number in java – recursive & iterative
  28. Generate/ print fibonacci series in java – recursive & iterative 
  29. Create or implement FizzBuzz game

Java 8 – Tutorial:

  1. Read a file line by line using java 8 lambda stream
  2. Java 8 Functional interface explained with examples (Comparator)
  3. Create Runnable task using functional interface 
  4. Impact of interface’s default method on multiple inheritance
  5. Join or combine two / multiple Strings using StringJoiner
  6. Find object from ArrayList of objects using lambda stream
  7. Search String in ArrayList collection – stream lambda
  8. Sort objects on multiple fields /properties – Comparator interface (lambda stream)
  9. Filter/Remove null & empty string from Array – lambda stream
  10. Filter/remove null element/String from ArrayList of objects – lambda stream
  11. Convert heterogeneous object into another – stream lambda
  12. Convert list of objects to /from map in java 8 lambda stream
  13. groupBy, mapping & statistics features in Java8 lambda stream
  14. Primitive streams example in java8 (IntStream, LongStream, DoubleStream)

Java Concurrency Framework Tutorial:

  1. What is thread in java with example (Real world analogy) ?
  2. Create/Implement thread/ task using runnable interface & thread class
  3. Create runnable task using functional interface – java8 lambda stream
  4. Thread join example using Runnable interface in java
  5. Create fixed thread pool in java using Executors
  6. Create single thread pool using executor in java 
  7. Custom Thread Pool implementation without using executor framework
  8. Concurrency – Producer & Consumer in java (Wait notify example)
  9. Create custom thread pool in java without executor framework
  10. Create or simulate deadlock in multi threading (concurrency)
  11. CountDownLatch concurrency/multithreading example in java
  12. Java concurrency example-Synchronize resources using Semaphore
  13. Concurrency – Synchronize resources using ReentrantLock in java 
  14. Inter thread communication in java (PipedInputStream /PipedOutputStream)

Java Exception and Error Tutorial:

  1. What is difference between error & exception in java ?
  2. What is difference between throw, throws & Throwable in java ?
  3. Generate Out of memory error in java
  4. Difference between checked & unchecked exception (class hierarchy)
  5. Simulate unchecked exceptions in java
  6. try with resources & AutoCloseable java 7
  7. Catch multiple exceptions before & after java 7
  8. Create custom or user defined unchecked exception 
  9. User defined custom Runtime/Unchecked exception

Java File Input Output (IO) operations:

  1. Read a file line by line using java 8 lambda stream
  2. Create temporary file in a temp or input directory in java
  3. Recursively list all files present in directory /sub-directories of input folder
  4. List all directories of input path – scope operator & file filter in java
  5. Recursively list all files & folders of input directory in java
  6. Create new file & folder (directory) in java
  7. Convert local file path to URL & URI in java
  8. Create or Write or dump java properties to file
  9. Read contents from console or command line (Scanner class)
  10. Java Scanner example – read & write contents from/to file
  11. Inter thread communication in java (PipedInputStream /PipedOutputStream)
  12. Check read,write,execute permission & hidden attribute of file
  13. List system drive & their total, free, used space
  14. List or display contents of compressed or zipped file
  15. Compress or zip directory (sub-directories) recursively – ZipOutputStream
  16. Create compress /zip file in java (ZipOutputStream class)
  17. File read write IO operation in java – StringWriter/StringReader
  18. Write file in java using PrintWriter (class hierarchy & example)
  19. Read & Write file in java using CharArrayReader & CharArrayWriter
  20. Read & write UTF file – BufferReader & BufferWriter (NIO)
  21. Read & Write UTF contents to/ from file in java (BufferReader /BufferWriter)
  22. InputStreamReader & OutputStreamWriter – UTF file
  23. BufferedReader & BufferedWriter (NIO) – Read & write file
  24. Read write file using BufferedReader & BufferedWriter in java
  25. Read/write file contents in java (InputStreamReader/OutputStreamWriter)
  26. Read & write file in java (FileInputStream/ FileOutputStream)
  27. Write or redirect standard output error stream to a file in java
  28. Write or redirect console output to a file & again reset to standard output in java

Java Reflection Tutorials:

  1. Get all fields or data members of class
  2. List all methods or functions of class
  3. Print public/protected/private constructors of class
  4. List public methods or functions of class
  5. Find out class name of an object at Runtime 
  6. Find type of objects at Runtime using instanceof operator
  7. Create object or instance of class by name using Class.forName