This repository is the collection of all the java programs that has been done in college as well as the collection of the program that were done while learning and understanding
java.
This repo has divided into three main categories and each of them have sub-categories that covers various topics and challenges.
Do join our Discord
- Create a new folder named
bin
inside of the Java-Programs folder. - Open your terminal at location where the Java-Programs is saved.
- Run the following command to compile the code within a specific folder. For eg. I want to compile the code within
src/college/understanding_interface
folder.
javac -d bin src/college/understanding_interface/*.java
- In the above command
-d
is a flag which means directory, specifying where to keep the compiled java programs. In this case we are specifying thebin
folder. - The next part
src/college/understanding_interface/*.java
is the location of the java files we want to compile.*.java
means include all the files with extension.java
. If we wanted to compile the code within another folder we would have used different location for examplesrc/learning/understanding_super/*.java
- Open new terminal and change your directory to bin.
cd bin
- Use
java <pakage name>.<class name>
to run the code in terminal.
- For example I want to run ArrayException.java which is at location
src/college/understanding_exceptions
so I will use
java src.college.understanding_exceptions.ArrayException
- which is basically
java <pakage name>.<class name>
Here you will find all the programs that were done in the lab.
Here you will find all the assignments that were done in the lab.
Programs | Discription |
---|---|
1. UserInput.java: | Program to show how to take user input. |
2. Table.java: | Printing table of any number using the loops. |
3. RevNum.java: | Finding the reverse of any number using the loops. |
4. DiffHighLow.java: | Finding the difference between the highest and the lowest number in an array. |
5. StringLetter.java: | Take name as input string and display each letter at new line. |
6. Palindrome.java: | Checks whether a given word is palindrome or not? |
7. Vowels.java: | Program that counts number of vowels in a string. |
8. StringSearch.java: | Program that searches for query string in main string. |
Programs | Discription |
---|---|
1. Inheritence1.java: | Program to demonstrate Inheritence in java. |
2. Abstraction.java: | Program to demonstrate Abstraction in java. |
Programs | Discription |
---|---|
1. Interface.java: | A program that shows the implementation of Interface in java with the help of taking input from the user, the program calculates the area of Square and Rectangle. |
2. InterfaceEx1.java: | This program demonstrates the interfaces in java. Interface are very similar to abstract classes |
3. InterfaceEx2.java: | This program demostrates the indirect way of achiving the multiple inheritance in java. |
4. InterfaceEx3.java:: | This program demostrates the inheritence in Interfaces. |
Programs | Discription |
---|---|
1. ExceptionEx1.java: | This program domonstrate the Exceptions in java. |
2. ExceptionEx2.java: | This program demonstrate the handling of multiple exceptions in java. |
3. ArrayException.java: | This program demonstrate the handling of multiple exceptions in an array in java. |
4. FinallyEx1.java: | Program to demonstrate the finally block. |
5. ThrowsEx1.java: | Code to demonstrate the use of throws keyword. |
6. ThrowEx1.java: | Code to demonstrate the use of throw keywords. |
7. CustomExceptionEx1.java: | Sample code to demonstrate on how to raise your own exceptions. |
8. CustomExceptionEx2.java: | Program given in college to raise your own exception when two string are same. |
Programs | Description |
---|---|
1. MyFrame.java: | Sample code to show on how to create window using java.awt. |
2. FrameButtons.java: | Program to demonstrate button in java.awt. |
3. FlowLayoutEx1.java: | Program to demonstrate flow layout in java. |
4. CustomLayout.java: | Program to demonstrate custom layout in java. |
5. ActionListenerEx1.java: | Program to demonstrate ActionListener in java.awt.event. |
6. Square.java: | GUI program to display the square of a entered number. |
7. Addition.java: | GUI program to accept two numbers and then display the addition of those two numbers in the frame. |
8. PalindromeEx1.java: | GUI program to check whether a number or a string is palindrome or not. |
9. ReverseStringEx1.java: | GUI program to reverse a string. |
10. NumToWords.java | GUI program to convert number to words. |
11. ColorFrame.java | GUI program to change the background colors when you click on buttons. |
12. SimpleCalculator.java | GUI program to accept two numbers from the user and calculate the sum,difference,multiplication & division on the clicks of specific button. |
13. Calculator.java | GUI program to accept two numbers from the user and calculate the sum,difference,multiplication & division on the clicks of specific button. |
Programs Swing | Description |
---|---|
1. SwingDemo.java | Basic java program to demonstrate creating of Swing program |
2. SwingEventDemo.java | This program demonstrates the use of event listener throgh a simple swing program |
3. SwingLabelImage.java | This program demonstrates the how to set a image to a label |
4. SwingOptionPane.java | This program demonstrates the use of dialog boxes in Swing |
5. SwingTextField.java | This program demonstrates the use of text fields |
6. SwingTextAndPassword.java | This program demonstrates the use of password field in swing |
7. SwingCheckbox.java | This program demonstrates the use of checkboxes |
8. SwingComboBox.java | This program demonstrates the use of comboboxes |
9. SwingCalculator.java | This program demonstrates the use of multiple frames and grid layouts to design the gui |
Programs Swing with JDBC | Description |
---|---|
1. ListData.java | This program demonstrates how to connect with an SQL database using the JDBC and integrate that with the java GUI |
Do read README to get started.
Programs | Discription |
---|---|
1. ConnectionDB.java: | This program demonstrates how to connect to the my sql database using JDBC Driver. |
2. InsertingData.java: | Program to demonstrate on how to insert data into the database. |
3. DynamicDataEntryEx1.java: | Program to take data from the user and insert into the database. |
4. ReadDataEx1.java: | Program to demonstrate on how to read data from the table in the sql database. |
5. ReadDataEx2.java: | Program to demonstrate on how to read specific data from table using userinput. |
6. UpdateData.java: | Program to demonstrate on how to update a particular record in the database using user input. |
7. DeleteData.java: | Program to demonstrate on how to delete specific record from table using user input. |
8. Crud.java: | Program that combined all the learned concepts into on single program. |
Programs | Discription |
---|---|
1. MyThread.java | Intro program that demonstrates creating thread using Thread class and Runnable interface |
2. NewThread and MultiChild | Program to demonstrate creating multiple threads and running them simultaneously |
3. SynchronizedBlock | Program to demonstrate synchonization in java |
Programs | Discription |
---|---|
1. Example.java: | Very first Java program. |
2. Example2.java: | Understanding about variables and various data types. |
3. IFsample.java: | Understanding conditional if statement in java. |
4. FORtest.java: | Understanding for loops in java. |
5. SpeedDS.java: | Understanding about long data type and its use with a simple program. |
6. Area.java: | Understanding about double data type and its use. |
7. CharDemo.java: | Understanding about char data type in java. |
8. BoolTest.java: | Understanding about bool data type. |
9. DynInit.java: | Dynamically assigning the value to a variable. |
10. Conversion.java: | Program to demonstrate type conversions. |
11. Promote.java: | Self promotions of data types in java. |
12. Array.java: | Simple program to demonstrate arrays in java. |
13. Fibonacci.java: | Get n number of elements in Fibonacc Series. |
14. LowerCaseVSUpperCase.java: | Check if the entered char is lowercase or uppercase. |
15. IncrementDecrement.java: | Understanding the increment and decrement operator assignments. |
16. Shadowing.java: | Understanding the concept of Shadowing in java. |
17. Test1.java: | Program to demonstrate how to pass the objects a parameter to a method. |
18. ReturningObjects.java: | Program to demonstrate how to return objects from a function. |
19. CallByReferenceVsValue.java: | Program to demostrate whether java uses call by reference or call by value. |
20. ConstructorOverloading: | Program to demonstrate construtor overloading in java. |
21. Recursion.java: | Program to demonstrate recursion in java. |
22. Figure.java: | Program to demonstrate method overriding in |
23. VarArgs.java: | A function that can take n number of arguments is explained in this program. |
Programs | Discription |
---|---|
1. UseStatic.java: | Program to demonstrate the use of static variables , methods and blocks. |
2. StaticDemo.java: | Program to demonstrate on how to call the static members of one class into another. |
Programs | Discription |
---|---|
1. SuperEx1.java | Program to demonstrate the use of super keyword in inheritance. |
2. SuperEx1.java | Program to demonstrate the use of super keyword in inheritance when member of super class is overridden. |
Programs | Discription |
---|---|
1. PalindromeGUI.java: | GUI program to reverse a string or a number and to check if it's a palindrome or not. |
2. Calculator.java: | Calculator App. |