Java programming solved programs/examples

This section contains solved java programs on all core java topics; choose categories to learn java topics through solved programs/examples with their output and explanation.

There are also Java Code Snippets linked under this section with solved programs, these code snippets are complete programs with output.

Here is the List of Java programming solved programs/examples with solutions and detailed explanation



Java Miscellaneous Programs

  1. Java program for Tower of Hanoi
  2. Java program for Binary Search Using Recursion
  3. Java program to read Boolean value from the file
  4. Java program to write Bytes using ByteStream
  5. Java program to read an array using ByteStream

Latest programs...

  1. Create temporary file in specified directory in Java. - July 19, 2019
  2. Create directory along with required nonexistent parent directories in Java. - July 19, 2019
  3. Create a temporary file in Java. - July 18, 2019
  4. Create a new empty file in Java. - July 18, 2019
  5. Create a directory in Java. - July 18, 2019
  6. Comparing the paths of the two files in Java. - July 18, 2019
  7. Conversion from String to Float in Java. - July 16, 2019
  8. Conversion from String to Long in Java. - July 16, 2019
  9. Conversion from String to Double in Java. - July 16, 2019
  10. Conversion from String to Integer in Java. - July 16, 2019
  11. Conversion from Float to String in Java. - July 15, 2019
  12. Conversion from Long to String in Java. - July 15, 2019
  13. Conversion from Double to String in Java. - July 15, 2019
  14. Conversion from Integer to String in Java. - July 15, 2019
  15. Java code for pause the execution. - July 14, 2019
  16. Java code to run multiple threads in a program. - July 14, 2019
  17. Declaring a constant in Java. - July 14, 2019
  18. String concatenation with primitive data type values in Java. - July 14, 2019
  19. String comparison using Collator and String classes in Java. - July 12, 2019
  20. String palindrome program in Java. - July 12, 2019
  21. Comparing Strings with equals() and compareTo() methods in Java. - July 12, 2019
  22. Uppercase to lowercase conversion without using any library function in Java. - July 12, 2019
  23. Lowercase to uppercase conversion without using any library function in Java. - July 12, 2019
  24. Using queue and stack in a single Java program using loops. - October 17, 2018
  25. Use of all the user defined exception keywords in a single Java program. - October 08, 2018
  26. Producer and Consumer Code in Java. - October 08, 2018
  27. Minimum swaps required to sort an array in Java. - August 08, 2018
  28. Java program for Left Rotation in Array. - August 08, 2018
  29. Java | Print Multiplication of two 2-D Arrays by traversing forward direction in first array and backward direction in second array. - June 18, 2018
  30. Java program to print upper diamond pattern of numbers and dollars . - March 30, 2018
  31. Java program to print upper diamond pattern of numbers. - March 30, 2018
  32. Java program to access variable from another class. - March 17, 2018
  33. Java program to demonstrate example of method overloading. - March 17, 2018
  34. Java program to remove duplicate elements from an array. - March 13, 2018
  35. Java program to concatenate two strings without using library function. - March 13, 2018
  36. Convert String to byte array and vice versa in java. - February 10, 2018
  37. Convert string lowercase to uppercase and vice versa without using library function in java. - February 08, 2018
  38. Java program to convert given number of seconds to hours, minutes and second. - February 03, 2018
  39. Java program to find second largest element in an array. - February 03, 2018
  40. Java program to find second smallest element in an array. - February 03, 2018
  41. Java program to find smallest element in an array. - February 03, 2018
  42. Java program to write and read a JSON File. - January 31, 2018
  43. Java program to read a CSV File. - January 31, 2018
  44. Java program to check whether the number is IMEI Number or not. - January 18, 2018
  45. Java program to check Pronic Number. - January 18, 2018
  46. Java program to check Harshad Number. - January 18, 2018
  47. Java program to check Evil number. - January 18, 2018
  48. Java program to count strings and integers from an array. - January 15, 2018
  49. Java program to handle multiple exceptions. - January 15, 2018
  50. Java program to divide two numbers and catch the exception, if divisor is 0. - January 15, 2018
  51. Java program to read marks between 1 to 100 (An Example of Exceptional Handling). - January 15, 2018
  52. Java program to swap first and last character of each word in a string. - January 08, 2018
  53. Java program to count number of notes (rupees) in given amount. - January 08, 2018
  54. Java program to find occurrences of palindrome words in a string. - January 08, 2018
  55. Java program to check whether Emrip number. - January 08, 2018
  56. Java program to find the correct output of student quiz. - January 06, 2018
  57. Java program to find sum of factorials from 1 to N. - January 06, 2018
  58. Java program to find the Length of Longest Sequence of 0’s in binary form of a number. - January 05, 2018
  59. Java program to find cube 1 to N. - January 05, 2018
  60. Java program to check whether a given matrix is Lower Triangular Matrix or not. - December 30, 2017
  61. Java program to check whether a matrix is symmetric or not. - December 30, 2017
  62. Java program to print boundary elements of the matrix. - December 30, 2017
  63. Java program to create a matrix and fill it with prime numbers. - December 30, 2017
  64. Java program to find perimeter of a rectangle. - December 30, 2017
  65. Program to find differences of two dates in days in java. - December 24, 2017
  66. Program to add given hours in current date and time in java. - December 24, 2017
  67. Program to create a two dimensional array fill it with given few characters in Java. - December 24, 2017
  68. Program to verify answers of answer sheets of N students in Java. - December 24, 2017
  69. Enable and Disable button in Java swing. - December 24, 2017
  70. Java program for bank management system. - December 17, 2017
  71. Java program to print patterns (2 Examples based on numbers pattern). - December 13, 2017
  72. Java program to print prime numbers between given range. - December 11, 2017
  73. Java program to multiply corresponding elements of two lists. - December 11, 2017
  74. How to extract some of the elements from given list in java? - December 11, 2017
  75. Java program to make first alphabet capital of each word in a string. - December 11, 2017
  76. Java program to calculate area of Hexagon. - December 10, 2017
  77. Java program to compare two numbers with each other. - December 10, 2017
  78. Java program to count factors of a given number. - December 10, 2017
  79. Java program to read and print a two dimensional array. - December 07, 2017
  80. Java program to sort a one dimensional array in ascending order. - December 07, 2017
  81. Java program to merge two one dimensional arrays. - December 07, 2017
  82. Java program to print EVEN and ODD elements from an array. - December 07, 2017
  83. Java program to delete a specific element from a one dimensional array. - December 07, 2017
  84. Java program to print ‘W’ pattern using stars. - December 07, 2017
  85. Java program to traverse all files of a directory/folder. - December 05, 2017
  86. Java program to convert string to Boolean. - December 05, 2017
  87. Java program to print Floyd’s triangle till given N rows. - December 05, 2017
  88. Java program to print pattern of numbers in triangle and reverse trainable form. - December 05, 2017
  89. Java program to check whether a given character is alphabet or not. - December 05, 2017
  90. Java program to create and reverse a linked list. - December 04, 2017
  91. Java program to Join Threads. - December 04, 2017
  92. Java program to print the months in different formats. - December 04, 2017
  93. Java program to print different dates of days like today, yesterday and tomorrow. - December 04, 2017
  94. Java program to print spiral pattern of the given input. - November 30, 2017
  95. Java program to move all zero at the end of the array. - November 30, 2017
  96. Java program to find differences between minimum and maximum numbers in an array. - November 30, 2017
  97. Java program to find average of all array elements. - November 30, 2017
  98. Java program to find missing elements in array elements. - November 30, 2017
  99. Java program to find the common strings in two string arrays. - November 25, 2017
  100. Java program to find the common elements in two integer arrays. - November 25, 2017
  101. Java program to validate input as integer value only. - November 25, 2017
  102. Java program to draw a rectangle using swing. - November 25, 2017
  103. Java program to get the last index of any given character in a string. - November 25, 2017
  104. How to get length of the string in java? - November 24, 2017
  105. Java program to read strings with different methods. - November 24, 2017
  106. Java program to draw a circle. - November 19, 2017
  107. Java program to concatenate two strings. - November 19, 2017
  108. Java program to read a file line by line. - November 19, 2017
  109. Java program to read content from one file and write it into another file. - November 19, 2017
  110. Java program to calculate compound interest. - November 19, 2017
  111. Java program to build a calculator. - November 19, 2017
  112. Java program to generate permutation and combination of the numbers. - November 17, 2017
  113. Java program to print all Armstrong numbers between given range. - November 17, 2017
  114. Java program to count total positives, negatives and zeros from an array. - November 17, 2017
  115. Java program to find mean of a given number. - November 15, 2017
  116. Java program to find sum of all digits. - November 15, 2017
  117. Java program to get file creation, last access and last modification time. - November 12, 2017
  118. Java program to get the file’s owner name. - November 09, 2017
  119. Java program to get the basic file attributes (specific to DOS). - November 09, 2017
  120. Java program to get the attributes of a file. - November 07, 2017
  121. Java program to print Pascal's triangle. - November 07, 2017
  122. Java program to print pattern of alphabets. - November 07, 2017
  123. Java program to print the diamond shape of stars. - November 07, 2017
  124. Java swing program to print a wave form with output. - November 03, 2017
  125. Java program to read and print all files from a zip file. - November 03, 2017
  126. Java program to print a rectangle using stars (java pattern program). - November 03, 2017
  127. Java program to check sparse matrix. - November 02, 2017
  128. Java program to subtract two matrices (subtraction of two matrices). - November 02, 2017
  129. Java program to multiply two matrices. - November 02, 2017
  130. Java program to print Christmas tree. - November 02, 2017
  131. Java program to print uppercase and lowercase alphabets. - November 02, 2017
  132. Java program to reverse words of a string. - November 01, 2017
  133. Java program to find occurrences of each character in a string. - November 01, 2017
  134. Java program to separate all tokens (words) using StringTokenizer. - November 01, 2017
  135. Java program to sort an array in descending order. - November 01, 2017
  136. Java program to sort an array in ascending order. - November 01, 2017


  1. Java program to replace element within the ArrayList.
    In this java program, we are going to learn how to replace element of an ArrayList? Here, we have an ArrayList and replace element of it.
  2. Java program to check Spy number.
    In this java program, we are going to check whether a given number is SPY number or not?
  3. Java program to check Neon number.
    In this java program, we are going to check whether a given number is Neon number or not?
  4. Java program to find sum of array elements.
    In this java program, we are going to learn how to read an array and find sum of all array elements?
  5. Java program to get current date and change date by adding given number of days.
    In this java program, we are going to learn how to get current date and change the system’s date by adding given number of days.
  6. Java program to check whether a file can be read or not.
    In this java program, we are going to check whether a given file can be read or not? To check this, we are using File.canRead() method.
  7. Java program to get minimum and maximum elements from the array.
    In this Java program, we are going to read an array with N elements and find the minimum (smallest) and maximum (largest) elements from given array elements.
  8. Java program to print message without using semicolon.
    In this java program, we are going to learn how to print any message without using semicolon?
  9. Java program for banking management system.
    In this java program, we will learn how to create a small project like banking system? In this program, we are using some of the banking related options like deposit, withdrawal etc.
  10. Java program to create directory/folder in particular drive.
    In this Java program, we will learn how we can create a directory or a folder? To create a directory, we use File.mkdir() method in Java.
  11. Java program to get the size of given file in bytes, kilobytes and megabytes.
    In this Java program, we are going to learn how to get the size of a given file in bytes, kilobytes and megabytes?
  12. Java program to check whether a file is hidden or not.
    In this java program, we are going to learn, how to check whether a file is hidden or not? Method isHidden() of File class is used to check it.
  13. Java program to find index of an element from an ArrayList.
    In this Java program, we are going to learn how to find an index of an element from an ArrayList? To find an index of an element using ArrayList.indexOf() method.
  14. Java program to search an element from an ArrayList.
    In this java program, we are going to learn how to search an element from an ArrayList? To find an element, we use contains() method of ArrayList class.
  15. Java program to create a sub list from an ArrayList.
    In this Java program, we are going to learn how to create a sub list from an ArrayList? This example contains a list of some elements and creates a sub list.
  16. Java program to remove all elements from an ArrayList.
    In this Java program, we are going to learn how to remove all elements from an ArrayList? Here, we are using ArrayList.clear() to remove all elements.
  17. Java program to remove elements from specific index from an ArrayList.
    In this program, we a going to learn to create an ArrayList, adding elements to ArrayList and removing elements from specific index.
  18. Java program to add elements in ArrayList and print them in reverse order.
    In this program, we are going to create an ArrayList, add elements in the ArrayList and print elements in reverse order.
  19. Java program to add element at specific index in ArrayList.
    In this program, we are going to learn create an ArrayList, adding elements at specific index and print them on output screen.
  20. Java program to create an ArrayList, add elements and print.
    In this java program, we are going to learn how to create an ArrayList, add elements in the ArrayList and print the elements on the output screen?
  21. Java program to read text from file from a specified index or skipping byte using FileInputStream.
    In this program, we are going to learn how to read text from a file after skipping some bytes and print them on the output screen using FileInputStream.
  22. Java program to determine number of bytes written to file using DataOutputStream.
    In this java program, we are going to learn how to get (determine) the number of bytes written to a file using DataOutputStream? Here, we will write text in file and print the number of written bytes.
  23. Java program to append text/string in a file.
    In this java program, we are going to learn how to append text/string in a given file? Here, we have a file with some pre written content and we are appending text in it.
  24. Java program to get the last modification date and time of a file.
    In this java program, we will learn how to get the file’s last modification date and time? Here, we will give a file name and program will print its last modification date and time.
  25. Java program to read characters from the file.
    In this java program, we will learn how to read characters from a file? Here, we are using ‘FileReader’ class and its method ‘read’ to read the characters from the file.
  26. Java program to read Boolean value from the file.
    In this java program, we are going to read Boolean value from the file using hasNextBoolean() method of Scanner class.
  27. Java program to rename an existing file.
    In this Java program, we are going to learn how to rename an existing file? This task can we performed using renameTo() method, which is a method of File class.
  28. Java program to write Bytes using ByteStream.
    In this program, we are going to learn to write bytes using ByteStream? To write data “byte-by-byte” in the file, we will use writeBytes() method.
  29. Java program to read an array using ByteStream.
    In this java program, we are going to learn how to read an array using ByteStream? ByteStream reads and write byte by byte data from/in a file.
  30. Java program to break a string into characters.
    In this article of java program, we will learn how to break a string into characters?
  31. Java program to count number of digits in a string.
    In this article of java program, we will learn how to count the number of digits in a string?
  32. Java program to count number of vowels in a string.
    In this article of java program, we will learn how to count the number of vowels in a string?
  33. Java program to count number of words in a sentence.
    In this article of java program, we will learn how to count the number of words in a given sentence (combination of strings)?
  34. Java program to count number of uppercase and lowercase letters in a string.
    In this Java program, we will learn how to count the number of uppercase and lowercase letters in a given string?
  35. Java program to demonstrate example of thread.
    This example is based on threading in java, here we will learn how to use thread in java?
  36. Java program to print star pattern using class.
    STAR pattern printing program in Java - This program will print the star pattern till N lines, N will be taken as input from the user.
  37. Java program to print pyramid of characters using class.
    PYRAMID of characters printing in Java - This program will print the pyramid of characters till N lines, N will be taken as input from the user.
  38. Java program to swap two integer numbers using class.
    Learn: How to read and swap integer numbers in Java language using class, that means swapping of numbers operations will be performed using class.
  39. Java program to get the IP address, Hostname based on given Hostname.
    Learn: How to get the host ip address (website ip address), host name based on given host name (website name), this program will take a host name as input and print the host name, ip address.
  40. Java program to print the hostname and IP address of Local system.
    Java program to find and print the host name, Ip address of local system. This program will print the IP address and Hostname of the system on which program will be executed.




Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.