forked from adityabiswal2147207/java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoops.java
More file actions
38 lines (31 loc) · 817 Bytes
/
Copy pathoops.java
File metadata and controls
38 lines (31 loc) · 817 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import java.util.Scanner;
import java.util.sca
class Pen{
String color;
String type;
public void check(){
if(color == "red" && type == "gel")
System.out.println("Your pen color is red which is of gel type");
else
System.out.println("Unknown brand");
}
public void printColor(){
System.out.print("Color: ");
System.out.println(this.color);
}
public void printType(){
System.out.print("Type: ");
System.out.println(this.type);
}
}
public class oops {
Scanner sc = new Scanner(System.in);
public static void main(String args[]){
Pen pen1 = new Pen();
pen1.color = "red";
pen1.type = "gel";
pen1.check();
pen1.printColor();
pen1.printType();
}
}