Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main {
- public static void main(String[] args) {
- Sq object1 = new Sq(); /// lera nrxm nayawate kawata yakam constractora
- Sq object2 = new Sq(5); /// lera 1 nrxm yawa pey
- Sq object3 = new Sq(5, 10); // lera 2 nrxm yawa pey
- }
- }
- class Sq { //// 1. classm drwstkrd
- int x;
- int y; /// 2. 2 variablem nwsy ba int nawyan x w y a
- Sq() { //// ba constractor wam lekrd agar nrxy nayame
- this.x = 1;
- this.y = 1;
- }
- Sq(int n1) { //// ba constractor wam le krd agar 1 nrxm ya pey tanha x bgore
- this.x = n1;
- this.y = 1;
- }
- Sq(int n1, int n2) { /// ba constractor wamlekrd agar 2 nrxm ya pey hardwky bgore
- this.x = n1;
- this.x = n2;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement