8000 OOPs using java is started · nitinmehra09/JavaProgramming@5572a7c · GitHub
[go: up one dir, main page]

Skip to content

Commit 5572a7c

Browse files
committed
OOPs using java is started
1 parent 68c0f54 commit 5572a7c

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

OOPs/Oops.class

416 Bytes
Binary file not shown.

OOPs/Oops.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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
Binary file not shown.

0 commit comments

Comments
 (0)
0