-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcustom_class.java
More file actions
39 lines (33 loc) · 1023 Bytes
/
custom_class.java
File metadata and controls
39 lines (33 loc) · 1023 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
39
import javax.swing.plaf.synth.SynthOptionPaneUI;
class employee {
int age;
String name;
int salary;
public void printdetails()
{
System.out.println("my age is " + age);
System.out.println("my name is - " + name);
System.out.println("the salary is "+salary);
}
}
public class custom_class {
public static void main(String[] args) {
System.out.println("the custom class");
employee varad = new employee(); // instantiating new employee object
employee amu = new employee();
// setting properties
//for amu
amu.age=45;
amu.name= "amruta dhumale";
amu.salary = 450;
//for varad
varad.age = 20;
varad.name = "varad the super star";
varad.salary=750;
// printing properties
// System.out.println(varad.age);
//System.out.println(varad.name);
//varad.printdetails();
amu.printdetails();
}
}