Industrial Training Projects Intial Commit
This commit is contained in:
13
IndustrialTrainingProjects/PrivateConBasic.java
Normal file
13
IndustrialTrainingProjects/PrivateConBasic.java
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
// Program to implement private constructor using the basic method.
|
||||||
|
|
||||||
|
package IndustrialTrainingProjects;
|
||||||
|
|
||||||
|
public class PrivateConBasic {
|
||||||
|
public static void main(String[] args){
|
||||||
|
PrivateConBasic obj=new PrivateConBasic("Hello");
|
||||||
|
|
||||||
|
}
|
||||||
|
private PrivateConBasic(String a){
|
||||||
|
System.out.println(a);
|
||||||
|
}
|
||||||
|
}
|
||||||
22
IndustrialTrainingProjects/PrivateConSingleton.java
Normal file
22
IndustrialTrainingProjects/PrivateConSingleton.java
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
// Program to implement private constructor using the singleton method.
|
||||||
|
|
||||||
|
package IndustrialTrainingProjects;
|
||||||
|
|
||||||
|
public class PrivateConSingleton {
|
||||||
|
private PrivateConSingleton () {
|
||||||
|
System.out.println("This is a private constructor.");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void instanceMethod() {
|
||||||
|
|
||||||
|
PrivateConSingleton obj = new PrivateConSingleton();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class Main {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
PrivateConSingleton.instanceMethod();
|
||||||
|
}
|
||||||
|
}
|
||||||
25
IndustrialTrainingProjects/README.MD
Normal file
25
IndustrialTrainingProjects/README.MD
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
## Introduction:
|
||||||
|
|
||||||
|
Here are programs that every budding programmer who is learning to code in Java should start with.
|
||||||
|
These programs are a compilation of many different types of programs and levels of programming you should try.
|
||||||
|
|
||||||
|
** These Codes are done during the Industrial Training Program. Any program you find here is taught during the
|
||||||
|
the training program. **
|
||||||
|
|
||||||
|
## Pre-Requisites:
|
||||||
|
|
||||||
|
1. A coding IDE or just use the CMD/Terminal on your Windows Pc/Mac respectively (I used VS Code for this).
|
||||||
|
|
||||||
|
2. Check that Java is properly installed in your system and the Path to Java is integratively set in your system.
|
||||||
|
|
||||||
|
3. Start by trying to create the program by yourself if you encounter any problems refer to the code in the program file,
|
||||||
|
if the problem still persist then create a issue or use Google/Stack Overlflow for help.
|
||||||
|
|
||||||
|
4. Done! You have successfully created the program in Java by your own.
|
||||||
|
|
||||||
|
## Serial:
|
||||||
|
|
||||||
|
|Serial No.|Program Name|Description of the program|
|
||||||
|
|----------|------------|--------------------------|
|
||||||
|
|1 | [PrivateConBasic.java](https://github.com/psavarmattas/Java-Projects/blob/master/IndustrialTrainingProjects/PrivateConBasic.java) | Program to implement private constructor using the basic method. |
|
||||||
|
|2 | [PrivateConSingleton.java](https://github.com/psavarmattas/Java-Projects/blob/master/IndustrialTrainingProjects/PrivateConSingleton.java) | Program to implement private constructor using the Singleton method. |
|
||||||
Reference in New Issue
Block a user