Skip to content

Commit

Permalink
java creating constructor code added
Browse files Browse the repository at this point in the history
  • Loading branch information
mdyasinahmed committed Jul 10, 2023
1 parent b66f9be commit 7f8ff75
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions src/OOPS/CONSTRACTORS.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,23 @@
// Declare
/**
* Class Test{
* Test(){
* // body
* Test(){
* // body
* }
* }
* }
*/
*/

class Main{
private String name;
//Constructor
Main(){
System.out.println("Constructor Called.");
name = "fun coder";
}

public static void main(String args[]){
// constructor is invoked while creating object in main class
Main obj = new Main();
System.out.println("The name is" + obj.name);
}
}
Binary file added src/OOPS/Main.class
Binary file not shown.

0 comments on commit 7f8ff75

Please sign in to comment.