8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 68c0f54 commit 5572a7cCopy full SHA for 5572a7c
OOPs/Oops.class
416 Bytes
OOPs/Oops.java
@@ -0,0 +1,27 @@
1
+class Pen{
2
+ String brand;
3
+ String type;
4
+ String color;
5
+ void printInfo(){
6
+ System.out.println(" brand :- " +this.brand);
7
+ System.out.println(" Color :- "+this.color);
8
+ System.out.println(" type :- "+this.type);
9
+ }
10
+}
11
+public class Oops {
12
+ public static void main(String[] args) {
13
+ System.out.println("pen 1 :");
14
+ Pen p1 = new Pen();
15
+ p1.brand = "Doms";
16
+ p1.type = "bollpen";
17
+ p1.color = "blue";
18
+ p1.printInfo();
19
+ System.out.println("pen 2 :");
20
+ Pen p2 = new Pen();
21
+ p2.brand = "dabur";
22
+ p2.color = "blue";
23
+ p2.type = "gel";
24
+ p2.printInfo();
25
+
26
27
OOPs/Pen.class
1.02 KB
0 commit comments