Serial no | important |
1 | Class Declaration |
2 | setter Method |
3 | getter Method |
4 | Main Method |
Class Declaration
class Class1 { str Name; }
setter Method
public void setName(str _Name) { Name = _Name; }
getter Method
public str getName() { return Name; }
Example
public static void main(Args _args) { Class1 c1; c1 = new Class1(); // 'new' method is inherited from the Object class. c1.setName("Rumman Ansari"); print c1.getName(); }
Comments
Post a Comment