|
|
|
|
JAVA ::: BASIC PROGRAMMING |
|
|
|
This section JAVA : Basic Programming contains source codes of many different type of Java Programs to learn the JAVA Basics. These Programs are well formatted and easy to understand. I am mainly following the book " Beginning Java 2" by Ivor Horton to learn Java.
select one of the Topics listed below:
|
Note: All the given files are in zip format, which can be uncompressed with the help of a compression tool. If you do not have any tool, then you can get one from Utilities : Compression Tools. |
|
|
Input - Output - Variables |
|
|
|
|
|
|
| JAVA_001 |
 |
A Java Program to print a string on the Standard Output Device. |
| JAVA_002 |
 |
A Java Program to declare and initialize Integer variables and print them on the Standard Output Device. |
| JAVA_003 |
 |
A Java Program to show the use of Increment and Decrement Operators. |
| JAVA_004 |
 |
A Java Program to declare and initialize Floating-Point variables and print them on the Standard Output Device. |
| JAVA_005 |
 |
A Java Program to read input from the Standard Input Device. |
| JAVA_006 |
 |
A Java Program to declare and initialize Boolean variables and print them on the Standard Output Device. |
| JAVA_063 |
 |
A Java Program to print some text on the same line using multiple print statements. |
|
|
|
|
|
Bitwise Operators |
|
|
|
|
|
|
| JAVA_007 |
 |
A Java Program to show the use of Bitwise Operator (&) AND. |
| JAVA_008 |
 |
A Java Program to show the use of Bitwise Operator (|) OR. |
| JAVA_009 |
 |
A Java Program to show the use of Bitwise Operator (^) XOR (Exclusive OR). |
| JAVA_010 |
 |
A Java Program to show the use of Bitwise Operator (~) Complement. |
| JAVA_011 |
 |
A Java Program to show the use of operator (<<) Shift Left filling with zero from the right. |
| JAVA_012 |
 |
A Java Program to show the use of operator (>>) Shift Right, propagating the sign bit from the left. |
| JAVA_013 |
 |
A Java Program to show the use of operator (>>>) Shift Right, filling with zeros from the left. |
|
|
|
|
|
Conditional Statements - Logical Operators |
|
|
|
|
|
|
| JAVA_015 |
 |
A Java Program to show the use of If Statement. |
| JAVA_016 |
 |
A Java Program to show the use of If-Else Statement. |
| JAVA_017 |
 |
A Java Program to show the use of Nested If-Else Statements. |
| JAVA_018 |
 |
A Java Program to show the use of Conditional AND Operator (&&) in If Statements. |
| JAVA_019 |
 |
A Java Program to show the use of Logical AND Operator (&) in If Statements. |
| JAVA_020 |
 |
A Java Program to show the use of Conditional OR Operator (||) in If Statements. |
| JAVA_021 |
 |
A Java Program to show the use of Logical OR Operator (|) in If Statements. |
| JAVA_022 |
 |
A Java Program to show the use of Logical or Boolean Negation i.e. NOT (!). |
| JAVA_023 |
 |
A Java Program to show the use of Conditional (Ternary) Operator. |
| JAVA_024 |
| A Java Program to show the use of Switch Statement. |
| JAVA_025 |
 |
A Java Program to show the use of Switch Statement for the same statement for different case labels. |
|
|
|
|
|
Loops - The Continue/Break Statement |
|
|
|
|
|
|
| JAVA_027 |
 |
A Java Program to show the use of For Loop. |
| JAVA_028 |
 |
A Java Program to show the use of While Loop. |
| JAVA_029 |
 |
A Java Program to show the use of Do-While Loop. |
| JAVA_030 |
 |
A Java Program to show the use of Nested Loops. |
| JAVA_031 |
 |
A Java Program to show the use of Continue Statement. |
| JAVA_032 |
 |
A Java Program to show the use of Labeled Continue Statement. |
| JAVA_033 |
 |
A Java Program to show the use of Break Statement. |
| JAVA_034 |
 |
A Java Program to show the use of Labeled Break Statement. |
|
|
|
|
|
Arrays - Arrays of Arrays |
|
|
|
|
|
|
| JAVA_035 |
 |
A Java Program to declare, initialize and print an array of integers. |
| JAVA_036 |
 |
A Java Program to copy the elements of an array into another array in reverse order and print them. |
| JAVA_037 |
 |
A Java Program to sort the contents of an array using Bubble Sort. |
| JAVA_038 |
 |
A Java Program to search an element in an array using Linear Search. |
| JAVA_039 |
 |
A Java Program to declare, initialize and print an array of characters. |
| JAVA_040 |
 |
A Java Program to declare, initialize and print a 2D array of integers. |
| JAVA_041 |
 |
A Java Program to calculate the addition of two matrices using 2D arrays of type float. |
|
|
|
|
|
Strings |
|
|
|
|
|
|
| JAVA_042 |
 |
A Java Program to declare, initialize and print a String object. |
| JAVA_043 |
 |
A Java Program to show an example of Arrays of String. |
| JAVA_044 |
 |
A Java Program to show an example of Concatination of Strings. |
| JAVA_045 |
 |
A Java Program to show the use of Comparison operator (==) for comparing Strings. |
| JAVA_046 |
 |
A Java Program to show the comparing of Strings for equality. |
| JAVA_047 |
 |
A Java Program to check the start and end of a String. |
| JAVA_048 |
 |
A Java Program to compare Strings by compring successive corresponding characters, starting with the first character in each String. |
| JAVA_049 |
 |
A Java Program to show an example of getting at characters in a String. |
| JAVA_050 |
 |
A Java Program to show an example of searching Strings for characters. |
| JAVA_051 |
 |
A Java Program to show an example of searching Strings for subStrings. |
| JAVA_052 |
 |
A Java Program to show an example of extracting subStrings from a String. |
| JAVA_053 |
 |
A Java Program to show an example of modifying String objects. |
| JAVA_054 |
 |
A Java Program to show an example of creating Character Arrays from String objects. |
| JAVA_055 |
 |
A Java Program to show an example of creating String objects from Character Arrays. |
|
|
|
|
|
StringBuffer |
|
|
|
|
|
|
| JAVA_056 |
 |
A Java Program to declare, initialize and print a StringBuffer object. |
| JAVA_057 |
 |
A Java Program to show some properties of StringBuffer object. |
| JAVA_058 |
 |
A Java Program to append a StringBuffer by StringBuffer, String objects and other Basic Data Types. |
| JAVA_059 |
 |
A Java Program to show insertion of StringBuffer, String objects and other Basic Data Types into a StringBuffer object. |
| JAVA_060 |
 |
A Java Program to show an example of extraction of characters from a StringBuffer objects. |
| JAVA_061 |
 |
A Java Program to change characters in a StringBuffer objects and to reverse its contents. |
| JAVA_062 |
 |
A Java Program to show an example of creating a String object from a StringBuffer Object. |
|
|
|
|
|
Classes |
|
|
|
|
|
|
| JAVA_064 |
 |
A Java Program to show an example of creating a class and using its object. |
| JAVA_065 |
 |
A Java Program to show an example of using initialization block to initialize the data members of a class. |
| JAVA_066 |
 |
A Java Program to show an example of using constructors in a class to initialize its data members. |
| JAVA_067 |
 |
A Java Program to show an example of overloading constructors in a class to initialize its data members. |
| JAVA_068 |
 |
A Java Program to show an example of using multiple classes in a program. |
| JAVA_069 |
 |
A Java Program to show an example of using a recursive method in a class. |
| JAVA_070 |
 |
A Java Program to show an example of using user-defined package in a program. |
| JAVA_071 |
 |
A Java Program to show an example of using a Static Nested Class. |
| JAVA_072 |
 |
A Java Program to show an example of using a Non-Static Nested Class. |
| JAVA_073 |
 |
A Java Program to show an example of using a Static Nested Class outside the Top-Level Class. |
|
|
|
|
|
Extending Classes and Inheritance |
|
|
|
|
|
|
| JAVA_074 |
 |
A Java Program to show an example of Driving and using a Class. |
| JAVA_075 |
 |
A Java Program to show an example of Overriding a Base Class Method. |
| JAVA_076 |
 |
A Java Program to show an example of Calling a Base Class Method from a Derived Class. |
| JAVA_077 |
 |
A Java Program to show an example of Polymorphism. |
| JAVA_078 |
 |
A Java Program to show an example of Multiple Levels of Inheritance. |
| JAVA_079 |
 |
A Java Program to show an example of using Abstract Class and Abstract Method. |
| JAVA_080 |
 |
A Java Program to show an example of Copying Objects i.e. Clonning Objects. |
|
|
|
|
|
Standard Libraray Class Methods |
|
|
|
|
|
|
| JAVA_014 |
 |
A Java Program to show the use of some Math Methods. |
| JAVA_026 |
 |
A Java Program to show the use of some Character Methods. |
|
|
|
|
|