Skip to content

Commit

Permalink
java oop class practice code added
Browse files Browse the repository at this point in the history
  • Loading branch information
mdyasinahmed committed Jul 9, 2023
1 parent a309757 commit d987505
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
Binary file modified src/OOPS/OOPS.class
Binary file not shown.
17 changes: 15 additions & 2 deletions src/OOPS/OOPS.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,30 @@ class Pen{
public void write(){
System.out.println("Write Something.");
}

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

public void printType(){
System.out.println(this.type);
}
}

// Creating Object
public class OOPS{
public static void main(String args[]){
Pen pen1 = new Pen();

pen1.color = "blue";
pen1.type = "gel";

pen1.write();

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

pen1.printColor();
pen2.printColor();
}
}

Expand Down
Binary file modified src/OOPS/Pen.class
Binary file not shown.

0 comments on commit d987505

Please sign in to comment.