❮ Previous Next ❯

n-arg Constructor(parameterized constructor):

The Constructor taking arguments is known as n-arg or parameterized constructor.

package java8s;

class A
{
      int x,y;
      A(int p, int q)    //parameterized constructor
      {
            x=p;
            y=q;
      }
      void show()
      {
            System.out.println("x="+x);
            System.out.println("y="+y);
      }
}
class Example1 {

      public static void main(String[] args) {
            A obj=new A(100,200);
            obj.show();
           

      }

}


n-arg-constructor

❮ Previous Next ❯


  Tutorials

Popular Links

Contact Us

address Plot No-741,2ND Floor
Opp. Bhagabati Temple,Jayadev Vihar
      Bhubaneswar-751013
      Email: info@silantechnology.com
      Phone: 0674-2361252
address
39877, sundale dr, apt#101, Fremont, California 94538, USA
       Phone: +1(262)388-7619

facebook twitter google linked in

© 2018 Silan Technology. All Rights Reserved