- class Mno
- {
- int salary;
- void Mno()
- {
- salary=25000;
- return;
- }
- public static void main(String...a)
- {
- Mno m1=new Mno();
- m1.Mno();
- System.out.println(m1.salary);
- System.out.println(m1);
- }
- }
- Output:
- 25000
- Mno@15db9742
- class Mno
- {
- int salary;
- Mno()
- {
- salary=25000;
- System.out.println(salary);
- }
- public static void main(String...a)
- {
- new Mno();
- }
- }
- Output:
- 25000
- class Pc
- {
- int salary;
- Pc(int s)
- {
- salary=s;
- System.out.println(salary);
- }
- public static void main(String...x)
- {
- Pc n1=new Pc(15000);
- Pc n2=new Pc(25000);
- Pc n3=new Pc(35000);
- }
- }
- Output:
- 15000
- 25000
- 35000
- class Npc
- {
- int salary;
- Npc()
- {
- System.out.println("NPC Invoke");
- }
- public static void main(String...x)
- {
- Npc n1= new Npc();
- Npc n2= new Npc();
- }
- }
- Output:
- Npc Invoke
- Npc Invoke
| Copyright ©2016 | All Rights Reserved |
| Design by Uves Khan |