Skip to content

Commit

Permalink
more classes and objects code added
Browse files Browse the repository at this point in the history
  • Loading branch information
mdyasinahmed committed Jul 7, 2023
1 parent 68f6d9f commit 94de855
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 0 deletions.
File renamed without changes.
Binary file not shown.
27 changes: 27 additions & 0 deletions src/OOP_Concepts/Classes/Classe & Objects 1/OOPS.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
class Pen{
String color;
String type;

public void write(){
System.out.println("Write Something.");
}

public void printColor(){
System.out.println(this.color);
}
}

public class OOPS{
public static void main(String args[]){
Pen pen1 = new Pen();
pen1.color = "blue";
pen1.type = "gel";

Pen pen2 = new Pen();
pen2.color = "black";
pen2.type = "ballpoint";

pen1.printColor();
pen2.printColor();
}
}
Binary file not shown.

0 comments on commit 94de855

Please sign in to comment.