Java


  1. Program to display "Hello World!!!" on console.
  2. Program to demonstrate how to declare a variable and assigned a value to it.
  3. Program to show use of type-casting.
  4. Program to demonstrate a one-dimensional array.
  5. Program to demonstrate a two-dimensional array.
  6. Program to demonstrate use of Conditional Operator.
  7. Program to demonstrate use of Nested If statement.
  8. Program to demonstrate use of If-Else ladder.
  9. Program to demonstrate use of switch statement.
  10. Program to add two numbers using Command Line Arguments.
  11. Program to read data from keyboard using Scanner class.
  12. Program to read data from keyboard using BufferedReader class.
  13. Menu driven program using switch-case.
  14. Program to swap two numbers without using third variable.
  15. Program to swap two numbers using third variable.
  16. Program to find largest among three numbers.
  17. Program to find factorial of a given number.
  18. Program to find given number is Even or Odd number.
  19. Program to find Fibonacci series upto given levels.
  20. Program to find reverse of a given number.
  21. Program to find whether given number is palindrome or not.
  22. Program to find whether given number is Armstrong no. or not.
  23. Program to find whether given number is Prime number or not.
  24. Program to find sum of digits of a number.
  25. Program to convert Decimal number into Binary number.
  26. Program for searching.
  27. Program to for Sorting.
  28. Program to find the given year is leap year or not.
  29. Program to display the addition of two matrices.
  30. Program to display the multiplication of two matrices.
  31. Program to generate the pascal triangle as shown below.
          * 
        * * * 
      * * * * * 
    * * * * * * * 
    
  32. Program to generate the pascal triangle as shown below.
    * 
    * * 
    * * * 
    * * * * 
    * * * * * 
    
  33. Program to generate the pascal triangle as shown below.
    * * * * * 
    * * * * 
    * * * 
    * * 
    * 
    
  34. Program to generate the pascal triangle as shown below.
    1 
    1 2 
    1 2 3 
    1 2 3 4 
    1 2 3 4 5 
    
  35. Program to generate the pascal triangle as shown below.
        *
       *A*
      *A*A*
     *A*A*A*
    *A*A*A*A*
  36. Program to demonstrate the use of "for each" version of for loop.
  37. Program to create a class Rectangle with getdata( ) and putdata( ) methods.
  38. Write a program to define a class having one 3-digit number, num as data member. Initialize and display reverse of that number.
  39. Program to define a class Student with four data members such as name, roll no.,sub1, and sub2. Define appropriate methods to initialize and display the values of data members. Also calculate total marks and percentage scored by student.
  40. Write a program to define a class Employee to accept emp_id, emp _name, basic_salary from the user and display the gross_salary.
  41. Write a program to define a class Fraction having data members numerator and denominator. Initialize three objects using different constructors and display its fractional value.
  42. Program to demonstrate use of 'this' keyword.
  43. Program to demonstrate use of 'static' keyword.
  44. Program to demonstrate use of varagrs (Variable length arguments).
  45. Program to demonstrate use of varargs (Variable length arguments) in constructor.
  46. Write a program to accept value of apple sales for each day of the week (using array of type float) and then, calculate the average sale of the week.
  47. Write a program to implement a Vector that accepts five items from the command line and store them in a Vector and display the objects stored in a Vector.
  48. Program Using 'Vector' class.
  49. Program to demonstrate use of 'Vector' class methods.
  50. Program to find all substrings of a string and print them. For example substrings of "fun" are:- "f", "fu", "fun", "u", "un","n". Use substring method of String class to find substring.
  51. Program to show use of some of 'String' class methods.
  52. Write a program to Implement a program to accomplish the following task using string / string Buffer class :
    1. Accept a password from user.
    2. Check if password is correct then display "Good" Else display "Incorrect password"
    3. Append the password with the string "Welcome to java!!!"
    4. Display the password in reverse order.
    5. Replace the character '!' in password with "*" character.
  53. Program to show use of some 'StringBuffer' class methods.
  54. Write a program to accept a string from the console and count number of vowels, consonants, digits, tabs and blank spaces in a string.
  55. Program to demonstrate Single Inheritance.
  56. Program to show simple example of inheritance.
  57. Write a program to implement the following Multi Level Inheritance.
  58. Write a program to implement the following Multiple Inheritance using interface.
  59. Write a program to implement Method Overriding for following inheritance.
  60. Program to demonstrate the constructor calling order.
  61. Program to use 'super' keyword to overcome name hiding.
  62. Program to demonstrate the use of 'final' keyword.
  63. Program for Abstract class and Abstract method.
  64. Program to do the following Hierarchical Inheritance.
  65. Program to define a class Item containing code and price. Accept this data for five object using array of objects. Display code, price in tabular form and also, display total price of all items.
  66. Program to define a class Tender containing data members cost and company name. Accept data for five objects and display company name for which cost is minimum.
  67. Program for Bubble Sort.
  68. Program to accept principal amount, rate of interest, no. of years from the user and display the simple interest.
  69. Program for Constructor Overloading.
  70. Program to use inheritance to extend Box class.
  71. Program to define a class 'employee' with data members as empid, name and salary. Accept data for 5 objects using Array of objects and print it.
  72. Program to accept first name, middle name and surname in three different strings and then concatenate the three strings to make full name.
  73. Program to accept number from user and convert it into binary by using wrapper class method.
  74. Program to demonstrate the use of "StringTokenizer" class.
  75. Program to check whether the given string is palindrome or not.
  76. Program to implement STACK and its operations.
  77. Program to create a interface 'printable' and implement it in 'InterfaceDemo' class.
  78. Program to create a interface 'Mango' and implement it in classes 'Winter' and 'Summer'.
  79. Program to implement the Multiple Inheritance (Exam Interface, Student & Result classes).
  80. Program to implement the Multiple Inheritance (Bank Interface, Customer & Account classes).
  81. Program to implement the Multiple Inheritance (Gross Interface, Employee & Salary classes).
  82. Program to demonstrate use of hierarchical inheritance using interface.
  83. Program to create user-defined package named "p1" and put class "A" in it.
  84. Program to import the class A from package p1.
  85. Program to create package named "myPackage" and put "DisplayMsg" class in it.
  86. Program to import package 'myPackage' and use the 'DisplayMsg' class in package.
  87. Program to define a package named 'useFul' with a class named 'UseMe' having following methods:
    1. area( ) -> To calculate the area of given shape.
    2. salary( ) -> To calculate the salary given basic salary, da, hra.
    3. percentage( ) -> To calculate the percentage given total marks and marks obtained.
  88. Program to create a class 'PackageUse' to import the above package 'useFul' and use the method area( ).
  89. Program to create a class 'Manager' to calculate the salary. Import the above package 'useFul' and make use of salary( ) method.
  90. Program to define class 'Student' to calculate the percentage. Import the above package 'useFul' and make use of the method percentage( ).
  91. Program to create a package named 'useFullToo' inside the above package 'useFul' with one class named 'useMeToo' having a method to display the message "This is from Inside Package".
  92. Program to import 'UseMeToo' package and use display( ) method.
  93. Program to input age from user and throw user-defined exception if entered age is negative.
  94. Program to raise a user defined exception if username is less than 6 characters and password does not match.
  95. Program to accept a password from the user and throw 'Authentication Failure' exception if the password is incorrect.
  96. Program to input name and age of a person and throw an user-defined exception, if the entered age is negative.
  97. Program to throw user defined exception if the given number is not positive.
  98. Program to throw a user-defined exception "String Mismatch Exception", if two strings are not equal (ignore the case).
  99. Program for extending Thread class.
  100. Program for implementing Runnable interface.
  101. Program to create two threads such that one thread displays the message "How do you do ?" and the other thread displays the message "Fine, Thank you!".
  102. Program to getting the main thread.
  103. Program for Naming a Thread.
  104. Program for pausing thread.
  105. Program for showing Thread class methods.
  106. Program to create two threads, one thread will print numbers  in ascending order where as second thread will print numbers in descending order between 1 to 15.
  107. Write a program to define two threads one will print 1 to 10 numbers whereas other will print 11 to 20 numbers.
  108. Program for creating three threads.
  109. Program to create two threads, one for even numbers and other for odd numbers.
  110. Program to create two threads, one will print numbers in original order and other in reverse order from 1 to 50.
  111. Program to create two threads, one for Prime number and other for Non-prime number.
  112. Program to create two threads, which alternately displays numbers from 1 to 10. Each thread sleeps for 1 second before displaying next number.
  113. Write a program to create a thread to print all even nos. from 1 to 50 with delay to 100 after each number.
  114. Program to input a string and print each character from that separately on screen with a delay of 100ms after each character.
  115. Program to demonstrate thread synchronization.
  116. Program to create an applet to display "Hello World".
  117. Program to create "Hello World" applet with applet tag in comments.
  118. Program to display life cycle of an Applet.
  119. Program to create an applet to accept a username in the form of parameter and print 'Hello <username>'.
  120. Program to accept the value of temperature in Celsius using param tag and display the temperature in Fahrenheit on Applet.
  121. Program to draw Lines on Applet.
  122. Program to draw Rectangles on Applet.
  123. Program to draw Ellipses on Applet.
  124. Program to draw Arcs on Applet.
  125. Program to draw Polygons on Applet.
  126. Program to draw Concentric Circles on Applet.
  127. Program to draw three concentric circles with three colors pink, red and green.
  128. Program to create an applet to accept a username as parameter and display number of characters.
  129. Program to set background and foreground color of an Applet.
  130. Program to use control loops in Applets.
  131. Program to display numbers from 1 to 10 on Applet such that each number will be display after delay of 100 ms.
  132. Program to display rolling banner using repaint( ) method of an Applet.
  133. Program to create applet to draw Bar Chart.
  134. Program to design an applet which displays three circles one below the other and fill them red, green and yellow color respectively.
  135. Program to design an applet which display a triangle filled with red colour and a message as "The triangle" in blue below it.
  136. Program to demonstrate some of font class methods.
  137. Program to draw different shapes on Applet.
  138. Program to draw Smiley in Applet.
  139. Program to display message "Hello World!" in different colors in applet.
  140. Program to display table of 1 to 10 on applet.
  141. Program to demonstrate use of Thread in an applet to show multithreading in Java.
  142. Program to draw a text at random location in random color.
  143. Program to draw a different shapes in Applet window.
  144. Program to demonstrate the Mouse events using Applet.
  145. Program for reading bytes from file using FileInputStream (Byte Stream).
  146. Program to read the contents of file using Character Stream.
  147. Program to write data into file using Character Stream.
  148. Implement a program to count number of lines and words in the file.
  149. Program to demonstrate use of ArrayList class.
  150. Program to show date and time using only Date class methods.
  151. Program to copy contents of one file into other file.
  152. Program to store the entered details (records) in a file named "stud.dat".
  153. Program to read records from file "stud.dat" and calculate total and percentage.
  154. Program to demonstrate "Stack" class in Java's Collection Framework.
  155. Program to demonstrate "Queue" class in Java's Collection Framework.
  156. Program to demonstrate "LinkedList" class in Java's Collection Framework.
  157. Program to demonstrate "HashMap" class in Java's Collection Framework.
  158. Program to create a simple mini paint application.
  159. Program to create a simple Calculator using Java AWT components.
  160. Program to create a Popup Menu using Java AWT.

Popular posts from this blog

Program to define a class 'employee' with data members as empid, name and salary. Accept data for 5 objects using Array of objects and print it.

First Android App | Android Development | Java

Program to design an applet which draws a circle (having color BLUE) inside a triangle (having color YELLOW)