Common Java Programs to demonstrate and (hopefully) explain a few core Java concepts. Comments are included to address readers wherever necessary.
- Program to swap two numbers input by the user without using third variable.
- Program to print the sum of digits of a number entered by the user.
- Program to print the reverse of the number entered by the user.
- Program to find the largest of three numbers using conditional statement.
- Program to create a class and call member functions.
- Program to implement employee class with data members i.e. name and salary and member functions.
- Program to print Fibonacci series up to first ten terms.
- Program to enter elements in array and display the array.
- Program to show implicit and explicit type casting.
- Program to demonstrate the use of static variables and static methods.
- Program to show the use of ‘final’ keyword.
- Program to illustrate the concept of default and parameterized constructors.
- Program to illustrate the concept of ‘this’ pointer.
- Program to illustrate the use ‘super’ keyword in inheritance.
- Program to create an interface and implement it using class.
- Program to illustrate the concept of packages.
- Program to demonstrate the concept of exception handling.
- Program to demonstrate the concept of inheritance.
- Program to create an abstract class.
- Program to demonstrate the concept of method overloading.