×

Java Programs

Java Practice

Java Basic Programs

This section contains solved programs of Java Basic Input, Output programs with basic mathematical, conditional statements and looping concepts.

All programs have explanation, output on different inputs.

List of Java Basic Programs

Find some of the programs (which are popular and most searched on the web) with source code, explanation and output.

  1. Java program to print "Hello world" (First program in Java)
  2. How to print different type of values in Java?
  3. How to read and print an integer value in Java?
  4. Java program to find sum and average of two integer numbers
  5. Java Program to find square, cube and square root of a given number
  6. Java program to check whether input number is EVEN or ODD
  7. Java program to swap two numbers with and without using third variable
  8. Java program to print uppercase and lowercase alphabets
  9. Java program to print Christmas tree
  10. Java program to print a rectangle using stars (java pattern program)
  11. Java program to print the diamond shape of stars
  12. Java program to print pattern of alphabets
  13. Java program to print Pascal's triangle
  14. Java program to generate permutation and combination of the numbers
  15. Java program to print all Armstrong numbers between given range
  16. Java program to find sum of all digits
  17. Java program to find mean of a given number
  18. Java program to build a calculator
  19. Java program to calculate compound interest
  20. Java program to validate input as integer value only
  21. Java program to print spiral pattern of the given input
  22. Java program to check whether a given character is alphabet or not
  23. Java program to print pattern of numbers in triangle and reverse trainable form
  24. Java program to print Floyd’s triangle till given N rows
  25. Java program to convert string to Boolean
  26. Java program to print ‘W’ pattern using stars
  27. Java program to count factors of a given number
  28. Program to verify answers of answer sheets of N students in Java
  29. Java program to compare two numbers with each other
  30. Java program to calculate area of Hexagon
  31. Java program to print prime numbers between given range
  32. Java program to print patterns (2 Examples based on numbers pattern)
  33. Java program to find perimeter of a rectangle
  34. Java program to generate random numbers between given ranges
  35. Java program to check whether a given number is ugly number or not
  36. Java program to check whether given number is Kaprekar number or not
  37. Java program to find cube 1 to N
  38. Java program to find the Length of Longest Sequence of 0’s in binary form of a number
  39. Java program to find sum of factorials from 1 to N
  40. Java program to find the correct output of student quiz
  41. Java program to check whether Emrip number
  42. Java program to count number of notes (rupees) in given amount
  43. Java program to read marks between 1 to 100 (An Example of Exceptional Handling)
  44. Java program to divide two numbers and catch the exception, if divisor is 0
  45. Java program to handle multiple exceptions
  46. Java program to check Evil number
  47. Java program to check Harshad Number
  48. Java program to check Pronic Number
  49. Java program to check whether the number is IMEI Number or not
  50. Java program to convert given number of seconds to hours, minutes and second
  51. Java program to swap two numbers using function
  52. Java program to check number is positive, negative or zero
  53. Java program to find largest number among three numbers
  54. Java program to check whether year is Leap year or not
  55. Java program to demonstrate example of enum data type
  56. Java program to demonstrate example of this keyword
  57. Java example for while loop demonstration
  58. Java example for do while loop demonstration
  59. Java program to Calculate the Compound Interest
  60. Java program to find the Greatest Common Divisor or Euclidean Algorithm Program or Highest Common Divisor.
  61. Java program to find the Greatest Common Factor or Euclidean Algorithm Program or Highest Common Factor.
  62. Java program to Calculate LCM (Least Common Multiple)
  63. Java program to calculate HCF of two numbers
  64. Java program to multiply two numbers using plus (+) operator
  65. Java program to perform subtraction without using minus (-) operator
  66. Java program to print the value in decimal, octal, hexadecimal using printf() method
  67. Java program to calculate the employee and employer provident fund
  68. Java program to calculate the gratuity of an employee
  69. Java program to compare float and double values
  70. Java program to find the remainder without using modulus (%) operator
  71. Java program to check a given character is alphanumeric or not without using a built-in method
  72. Java program to check a given character is a digit or not without using the built-in library method
  73. Java program to check a given character is a whitespace character or not without using the built-in library method
  74. Java program to check a given character is an uppercase character or not without using the built-in library method
  75. Java program to check a given character is a lowercase character or not without using the built-in library method
  76. Java program to check a given character is a punctuation mark or not without using the built-in library method
  77. Java program to check a given character is a printable character or not without using the built-in library method
  78. Java program to convert a given number of days into years, weeks, days
  79. Java program to find the roots of a quadratic equation
  80. Java program to find the (GCD) Greatest Common Divisor
  81. Java program to find the (LCM) Lowest Common Multiple
  82. Java program to calculate the area of a triangle based on given three sides
  83. Java program to calculate the area of a triangle based on a given base and height
  84. Java program to calculate the area of Trapezium
  85. Java program to calculate the area of Rhombus
  86. Java program to calculate the area of Parallelogram
  87. Java program to calculate the area of Cube
  88. Java program to find the Surface Area and volume of the cylinder
  89. Java program to calculate the surface area, volume, and space diagonal of cuboids
  90. Java program to calculate the surface area and volume of Cone
  91. Java program to calculate the surface area and volume of Sphere
  92. Java program to calculate the mean, variance, and standard deviation of real numbers
  93. Java program to read coordinate points and determine its quadrant
  94. Java program to calculate the value of nCr
  95. Java program to calculate the value of nPr
  96. Java program to calculate the product of two binary numbers
  97. Java program to add two complex numbers
  98. Java program to extract the last two digits from a given year
  99. Java program to read the height of the person, and the print person is taller, dwarf, or average height person
  100. Java program to find the sum of two numbers using binary addition
  101. Java program to find subtraction of two numbers using binary subtraction
  102. Java program to extract bytes from an integer (Hex) value
  103. Java program to convert hexadecimal byte to decimal
  104. Java program to read a weekday number and print weekday name using switch statement
  105. Java program to read gender (M/F) and print the corresponding gender using a switch statement
  106. Java program to check whether a character is a VOWEL or CONSONANT using switch statement
  107. Java program to check whether the number is EVEN or ODD using switch statement
  108. Java program to find the number of days in a month using a switch statement
  109. Java program to validate date and print weekday of the given date
  110. Java program to clear console screen
  111. Java program to sleep program execution for specified milliseconds
  112. Java program to design a digital clock
  113. Java program to check a given IP address is valid or not
  114. Java program to check a given Email address is valid or not
  115. Java program to store the date in a single integer variable
  116. Java program to store the time in a single integer variable
  117. Java program to print string in hexadecimal format
  118. Java program to extract octets from IP address
  119. Java program to determine the class of a given IP address
  120. Java program to find the number of bits required to represent a number
  121. Java program to swap the first and second bits of an integer number
  122. Java program to check whether all bits of the number are UNSET (LOW)
  123. Java program to swap bytes of an integer number
  124. Java program to reverse bits of the given number
  125. Java program to count total HIGH bits of the given number
  126. Java program to swap two nibbles of a given byte
  127. Java program to demonstrate the example of left shift (<<) operator
  128. Java program to demonstrate the example of the right shift (>>) operator
  129. Java program to SET and CLEAR bits of the given number
  130. Java program to implement infinite loop using while loop
  131. Java program to implement infinite loop using do-while loop
  132. Java program to implement nested loop using for loop
  133. Java program to demonstrate the break statement with while and for loop
  134. Java program to demonstrate the break statement with a nested loop
  135. Java program to demonstrate the continue statement with while and for loops
  136. Java program to swap two numbers using bitwise operator
  137. Java program to find the highest bit set for a given integer number
  138. Java program to check if all the bits of a given integer number are HIGH or not
  139. Java program to count the total HIGH bits in the given number
  140. Java program to check binary representation of the given number is palindrome or not
  141. Java program to check a given number is EVEN or ODD using bit masking
  142. Java program to check nth bit of 16-bit number is set or not
  143. Java program to check a number contains the alternative pattern of bits
  144. Java program to find the next number that is the power of 2
  145. Java program to find the position of MSB bit of an integer number
  146. Java program to round off an integer number to the next lower multiple of 2
  147. Java program to count the number of leading zeros in a binary number
  148. Java program to swap two bits of a 32-bit integer number
  149. Java program to check a given number is the power of 2 using bitwise operator
  150. Java program to count the number of bits to be flipped to convert a number to another number
  151. Java program to print bits that need to be flipped to convert a number to another number


Comments and Discussions!

Load comments ↻





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