-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6cc4257
commit 05140fe
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
|
||
|
||
// Java - Class | ||
class Pen{ | ||
String color; | ||
String type; | ||
|
||
public void write(){ | ||
System.out.println("Write Something."); | ||
} | ||
|
||
public void printColor(){ | ||
System.out.println(this.color); | ||
} | ||
|
||
public void printType(){ | ||
System.out.println(this.type); | ||
} | ||
} | ||
|
||
class Student{ | ||
String name; | ||
int age; | ||
|
||
public void printInfo(){ | ||
System.out.println(this.name); | ||
System.out.println(this.age); | ||
} | ||
} | ||
|
||
|
||
public class CLASSES{ | ||
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(); | ||
|
||
|
||
Student s1 = new Student(); | ||
s1.name = "Yasin"; | ||
s1.age = 20; | ||
s1.printInfo(); | ||
} | ||
} |
Empty file.