January 1st, 2011

Variable Control

Payne 15A Variable Voltage Control 18TBP 1 15 Single Phase Power Transformer
Payne 15A Variable Voltage Control 18TBP 1 15 Single Phase Power Transformer
Paypal   US $69.00
Pelton Crane Variable Intra Oral Illumination Control 054877 New Retails 520
Pelton Crane Variable Intra Oral Illumination Control 054877 New Retails 520
Paypal   US $360.00
VariZoom VZRock Variable Rocker Control for LANC Camcorders Sony Canon
VariZoom VZRock Variable Rocker Control for LANC Camcorders Sony Canon
Paypal   US $99.99
KB Electronics208 230 VAC 50 60Hz variable speed DC motor control 3 4 HP max
KB Electronics208 230 VAC 50 60Hz variable speed DC motor control 3 4 HP max
Paypal   US $50.00
Homedics Body Charger with Heat and Variable Massage Control
Homedics Body Charger with Heat and Variable Massage Control
Paypal   US $6.99
Frigidaire Affinity Front Load Washer 134409905 Variable Speed MOTOR CONTROL
Frigidaire Affinity Front Load Washer 134409905 Variable Speed MOTOR CONTROL
Paypal   US $39.00
HONEYWEL HEAT GIANT 16 TALL VARIABLE HEAT FAN CONTROLS
HONEYWEL HEAT GIANT 16 TALL VARIABLE HEAT FAN CONTROLS
Paypal   US $13.99
Router Speed Control Variable Speed Controller
Router Speed Control Variable Speed Controller
Paypal   US $19.99
LMH6518 900MHz Digital controlled Variable Gain Amp Qty2
LMH6518 900MHz Digital controlled Variable Gain Amp Qty2
Paypal   US $8.90
Variable Speed Controller for Fan or Small Tool
Variable Speed Controller for Fan or Small Tool
Paypal   US $9.99
DREMEL MODEL 221 VARIABLE SPEED CONTROL FOOT USED
DREMEL MODEL 221 VARIABLE SPEED CONTROL FOOT USED
Paypal   US $9.95
Electronic Variable Hi Hat Controller Roland TD Module Alesis DM10 modules
Electronic Variable Hi Hat Controller Roland TD Module Alesis DM10 modules
Paypal   US $102.50
Aerospace Logic A200 Variable Intensity Lighting Controller DDC200
Aerospace Logic A200 Variable Intensity Lighting Controller DDC200
Paypal   US $20.00
MC 68 Treadmill Variable Speed Motor Control Proform PN 174518
MC 68 Treadmill Variable Speed Motor Control Proform PN 174518
Paypal   US $39.99
Control Techniques Emerson 1401 UniDrive 1hp 480v 3phase variable speed drive
Control Techniques Emerson 1401 UniDrive 1hp 480v 3phase variable speed drive
Paypal   US $20.00
FOSTEX E 16 REEL TO REEL VARIABLE SPEED CONTROL UNIT VERY CHEAP DISCOUNTED PRICE
FOSTEX E 16 REEL TO REEL VARIABLE SPEED CONTROL UNIT VERY CHEAP DISCOUNTED PRICE
Paypal   US $14.99
Control Techniques Emerson 1405 UniDrive 5hp 480v 3phase variable speed drive
Control Techniques Emerson 1405 UniDrive 5hp 480v 3phase variable speed drive
Paypal   US $125.95
Distech ECC VAV Variable Air Volume Controller
Distech ECC VAV Variable Air Volume Controller
Paypal   US $20.00
GE KTD 405 3 Axis PTZ Variable Speed Desktop Keyboard Controller
GE KTD 405 3 Axis PTZ Variable Speed Desktop Keyboard Controller
Paypal   US $156.00
110 Volt 26 AMP Full Variable Router Speed Control Attachment w Carrying Strap
110 Volt 26 AMP Full Variable Router Speed Control Attachment w Carrying Strap
Paypal   US $35.00
10 Variable Fan Speed Controls 17001 W Fan Switch Light Dimmer Switch Combo
10 Variable Fan Speed Controls 17001 W Fan Switch Light Dimmer Switch Combo
Paypal   US $103.00
John Deere Round Fender Variable Speed Control Arm and Quadrants 110 112
John Deere Round Fender Variable Speed Control Arm and Quadrants 110 112
Paypal   US $4.95
Caterpillar Variable Vibratory Controller Assembly P N 138 8585
Caterpillar Variable Vibratory Controller Assembly P N 138 8585
Paypal   US $873.83
ITT Aquavar CPC 40231 variable speed controller
ITT Aquavar CPC 40231 variable speed controller
Paypal   US $2,000.00
NEW JANDY VS FHP20 FLOPRO 2HP VARIABLE SPEED POOL PUMP W CONTROLLER
NEW JANDY VS FHP20 FLOPRO 2HP VARIABLE SPEED POOL PUMP W CONTROLLER
Paypal   US $829.95
GE KTD 405 3 Axis PTZ Variable Speed Desktop Keyboard Controller NOS
GE KTD 405 3 Axis PTZ Variable Speed Desktop Keyboard Controller NOS
Paypal   US $51.00
GE Security Three Axis Variable Speed Desktop Controller Keypad KTD 405
GE Security Three Axis Variable Speed Desktop Controller Keypad KTD 405
Paypal   US $.01
AC FAN External Manual Variable Fan speed controller OK501
AC FAN External Manual Variable Fan speed controller OK501
Paypal   US $11.84
Vintage NOS Mallory Radio Volume Controls Variable Resistors Potentiometer 8 pcs
Vintage NOS Mallory Radio Volume Controls Variable Resistors Potentiometer 8 pcs
Paypal   US $14.99
BRAND NEW GRUNDFOS SQE CU301 Constant Pressure Control Box Variable Speed
BRAND NEW GRUNDFOS SQE CU301 Constant Pressure Control Box Variable Speed
Paypal   US $289.50
SPEEDSTER Inline Fan Speed Control Controller Variable
SPEEDSTER Inline Fan Speed Control Controller Variable
Paypal   US $24.34
LUTRON Nova Fully Variable Fan Control Single Pole 6A Grey
LUTRON Nova Fully Variable Fan Control Single Pole 6A Grey
Paypal   US $30.00
HEATED CAR ELECTRIC BLANKET TRAVEL WARMER AUTOMOTIVE WITH VARIABLE CONTROLLER
HEATED CAR ELECTRIC BLANKET TRAVEL WARMER AUTOMOTIVE WITH VARIABLE CONTROLLER
Paypal   US $29.95
Arkay Corp Pictorial Control Variable Attachment
Arkay Corp Pictorial Control Variable Attachment
Paypal   US $15.00
Variable Fan Speed Controller speedster hydroponics inline fan exhaust air
Variable Fan Speed Controller speedster hydroponics inline fan exhaust air
Paypal   US $24.27
Comfortaire WhisperFlo 4200 Control Panel for Variable Firmness Mattresses
Comfortaire WhisperFlo 4200 Control Panel for Variable Firmness Mattresses
Paypal   US $9.99
NEW Eaton Cutler Hammer Johnson Controls 6HP 75HP 480v AC Variable Speed Drive
NEW Eaton Cutler Hammer Johnson Controls 6HP 75HP 480v AC Variable Speed Drive
Paypal   US $949.00
MC 60 Treadmill Variable Speed Motor Control Proform PN 128957
MC 60 Treadmill Variable Speed Motor Control Proform PN 128957
Paypal   US $39.99
NEW Eaton Cutler Hammer Johnson Controls 60HP 75HP 480v AC Variable Speed Drive
NEW Eaton Cutler Hammer Johnson Controls 60HP 75HP 480v AC Variable Speed Drive
Paypal   US $3,849.00
Flux Wire Welder Mig 100 Welding Machine Automotive New Variable Speed Control
Flux Wire Welder Mig 100 Welding Machine Automotive New Variable Speed Control
Paypal   US $159.99
35 Bay Panel LED light w 4X PC Cooling Fan Variable Speed Controller
35 Bay Panel LED light w 4X PC Cooling Fan Variable Speed Controller
Paypal   US $8.00
ROUTER SPEED CONTROLLER VARIABLE AC DC MOTOR RHEOSTAT
ROUTER SPEED CONTROLLER VARIABLE AC DC MOTOR RHEOSTAT
Paypal   US $20.50
Speed Control Controller For Inline Fan Speedster Blower Variable Hydroponics US
Speed Control Controller For Inline Fan Speedster Blower Variable Hydroponics US
Paypal   US $28.95
GE KTD 404 Variable Speed Controller Keypad Audio Amplifier 2way Communication
GE KTD 404 Variable Speed Controller Keypad Audio Amplifier 2way Communication
Paypal   US $19.99
NIB HOT TOOLS Model 1190 25 Gold Tone Flat Iron w Variable Heat Controls NEW
NIB HOT TOOLS Model 1190 25 Gold Tone Flat Iron w Variable Heat Controls NEW
Paypal   US $24.99
REMINGTON WET TO DRY 225 Ceramic Flat Iron Variable Heat Control EUC BONUS
REMINGTON WET TO DRY 225 Ceramic Flat Iron Variable Heat Control EUC BONUS
Paypal   US $14.99
NIB HER STYLER FOREVER 15 Ceramic Flat Iron w Variable Heat Controls RRP $175
NIB HER STYLER FOREVER 15 Ceramic Flat Iron w Variable Heat Controls RRP $175
Paypal   US $49.99
GAS LOG REMOTE CONTROL SYSTEM RMC1E N VARIABLE
GAS LOG REMOTE CONTROL SYSTEM RMC1E N VARIABLE
Paypal   US $269.00
Ok501 Manual Variable for AC FAN Speed Controller
Ok501 Manual Variable for AC FAN Speed Controller
Paypal   US $11.84
35 Bay Panel LED light w 4X PC Cooling Fan Variable Speed Controller 10W 12V
35 Bay Panel LED light w 4X PC Cooling Fan Variable Speed Controller 10W 12V
Paypal   US $8.95
George Foreman 80 Square Inch Nonstick Grill with Variable Temperature Control
George Foreman 80 Square Inch Nonstick Grill with Variable Temperature Control
Paypal   US $49.95
Radon Blower BASE MOUNT with variable Speed control
Radon Blower BASE MOUNT with variable Speed control
Paypal   US $132.00
POWER TOOL VARIABLE SPEED MOTOR CONTROL 120V 15 AMP NEW
POWER TOOL VARIABLE SPEED MOTOR CONTROL 120V 15 AMP NEW
Paypal   US $18.99
Router Speed Controller Dimmer Variable Motor Control
Router Speed Controller Dimmer Variable Motor Control
Paypal   US $26.74
10W 35 12V 6v LED light Bay Panel 4 PC Cooling Fan Variable Speed Controller
10W 35 12V 6v LED light Bay Panel 4 PC Cooling Fan Variable Speed Controller
Paypal   US $8.54
Singer Replacement 4 Prong Pin Foot Pedal Cord With Variable Speed Control
Singer Replacement 4 Prong Pin Foot Pedal Cord With Variable Speed Control
Paypal   US $22.95
UNIMAT SL1000 DB200 LATHE MOTOR PERMANENT MAGNET AC VARIABLE SPEED CONTROL
UNIMAT SL1000 DB200 LATHE MOTOR PERMANENT MAGNET AC VARIABLE SPEED CONTROL
Paypal   US $138.00
Variable Speed Control Rheostat potentiometer motor AC
Variable Speed Control Rheostat potentiometer motor AC
Paypal   US $18.99
New Allen Bradley 160SSC 160 BA01NSF1P1 Series C 05HP Variable Speed Controller
New Allen Bradley 160SSC 160 BA01NSF1P1 Series C 05HP Variable Speed Controller
Paypal   US $150.00
Motor Variable Speed Controller Model Dart 57AC10 27 European
Motor Variable Speed Controller Model Dart 57AC10 27 European
Paypal   US $99.00
Electric Motor AC DC Control Rheostat Variable Speed
Electric Motor AC DC Control Rheostat Variable Speed
Paypal   US $18.99
PANASONIC PANABRATOR IV EV222 WITH VARIABLE SPEED CONTROL AND HEAT
PANASONIC PANABRATOR IV EV222 WITH VARIABLE SPEED CONTROL AND HEAT
Paypal   US $29.99
VITA MIX PREP PRO DRINK MACHINE VARIABLE SPEED CONTROL REPLACEMENT PART
VITA MIX PREP PRO DRINK MACHINE VARIABLE SPEED CONTROL REPLACEMENT PART
Paypal   US $39.95
2 pc FAN SPEED CONTROL Air inline duct Variable Speedster Controller acsc bully
2 pc FAN SPEED CONTROL Air inline duct Variable Speedster Controller acsc bully
Paypal   US $42.89
Universal Manual Variable Boost Controller Controllers V 2 Dial up to 36psi
Universal Manual Variable Boost Controller Controllers V 2 Dial up to 36psi
Paypal   US $23.49
Active Air Duct Fan Variable Speed Controller Control
Active Air Duct Fan Variable Speed Controller Control
Paypal   US $27.00
ALESIS REALHAT PEDAL CONTINUOUSLY VARIABLE CONTROL
ALESIS REALHAT PEDAL CONTINUOUSLY VARIABLE CONTROL
Paypal   US $62.49
Speedster Variable Speed Fan Controller Control Exhaust Inline Dimmable Air
Speedster Variable Speed Fan Controller Control Exhaust Inline Dimmable Air
Paypal   US $24.55
Manual 12V Variable Fan Speed Controller 4 Pin Molex Connector Car Boat RV NEW
Manual 12V Variable Fan Speed Controller 4 Pin Molex Connector Car Boat RV NEW
Paypal   US $19.99
VARIABLE SPEED FOOT PEDAL CONTROL ELECTRIC POWER TOOL SWITCH CONTROLLER
VARIABLE SPEED FOOT PEDAL CONTROL ELECTRIC POWER TOOL SWITCH CONTROLLER
Paypal   US $29.99
Variable Speed Foot Control for ROTARY TOOLS DREMEL
Variable Speed Foot Control for ROTARY TOOLS DREMEL
Paypal   US $14.99
Pottery Wheel Variable Speed Box Control Rheostat
Pottery Wheel Variable Speed Box Control Rheostat
Paypal   US $18.99
SCROLL SAW MOTOR VARIABLE SPEED CONTROL TOOL NEW
SCROLL SAW MOTOR VARIABLE SPEED CONTROL TOOL NEW
Paypal   US $18.99
Motor Control 100 ohm 25W Variable Resistor Rheostat
Motor Control 100 ohm 25W Variable Resistor Rheostat
Paypal   US $9.08
DANFOSS VLT VARIABLE SPEED DRIVE 175H4760 CONTROL CARD
DANFOSS VLT VARIABLE SPEED DRIVE 175H4760 CONTROL CARD
   US $299.99
KA7500 ManuSAMSUNG EncapsulationDIPVariable Dead Time Provides Control
KA7500 ManuSAMSUNG EncapsulationDIPVariable Dead Time Provides Control
Paypal   US $1.00
Cuttler Hammer SV9020 20 HP AC Motor Variable Speed Drive Control VFD
Cuttler Hammer SV9020 20 HP AC Motor Variable Speed Drive Control VFD
Paypal   US $1,200.00
SOUNDSTREAM XBP 10 SPL SIGNAL PROCESSOR WITH DASH REMOTE CONTROL w VARIABLE EQ
SOUNDSTREAM XBP 10 SPL SIGNAL PROCESSOR WITH DASH REMOTE CONTROL w VARIABLE EQ
Paypal   US $77.77
HELLER REVERSIBLE VARIABLE SPEED MOTOR 2T60 6 W CONTROL VARIAC CONNECTOR BOX
HELLER REVERSIBLE VARIABLE SPEED MOTOR 2T60 6 W CONTROL VARIAC CONNECTOR BOX
Paypal   US $124.50
AMSCO 78IS 1 Variable Intensity Lighting Control
AMSCO 78IS 1 Variable Intensity Lighting Control
Paypal   US $98.00
2008 INFINITI G37 COUPE SPORT OEM VARIABLE VALVE TIMING CONTROL MODULE VQ37 27K
2008 INFINITI G37 COUPE SPORT OEM VARIABLE VALVE TIMING CONTROL MODULE VQ37 27K
Paypal   US $129.99
Danfoss VLT 3008 variable speed Drive controller VFD on off for rev ramp
Danfoss VLT 3008 variable speed Drive controller VFD on off for rev ramp
Paypal   US $899.00
Heat Troller Variable Heated Grips controller SHG
Heat Troller Variable Heated Grips controller SHG
Paypal   US $59.95
LaROS 16 7 8 WIDE x 155 VARIABLE SPEED CONVEYOR PENTA DRIVE MOTOR CONTROL
LaROS 16 7 8 WIDE x 155 VARIABLE SPEED CONVEYOR PENTA DRIVE MOTOR CONTROL
Paypal   US $1,850.00
Dayton AZ527E DRIVE VARIABLE DC CONTROL 90VDC 115VAC 50 60HZ
Dayton AZ527E DRIVE VARIABLE DC CONTROL 90VDC 115VAC 50 60HZ
Paypal   US $64.99
WALKER MODEL SARCVB VARIABLE TABLE CONTROLLER 1140
WALKER MODEL SARCVB VARIABLE TABLE CONTROLLER 1140
Paypal   US $800.00
DART CONTROLS VARIABLE SPEED ANALOG DC CONTROLLER 123D C 24 36 VAC
DART CONTROLS VARIABLE SPEED ANALOG DC CONTROLLER 123D C 24 36 VAC
Paypal   US $74.99
The Speedster Variable Fan Speed Controller
The Speedster Variable Fan Speed Controller
Paypal   US $39.95
Power Steering Variable Assist Control Un ZF 85106019088
Power Steering Variable Assist Control Un ZF 85106019088
Paypal   US $166.57
Herley Custom Variable Frequency Control Generator Box
Herley Custom Variable Frequency Control Generator Box
Paypal   US $99.67
DART CONTROLS VARIABLE DC DRIVE 510 100RC FD 60002 1
DART CONTROLS VARIABLE DC DRIVE 510 100RC FD 60002 1
Paypal   US $120.00
NEW DELTA ELECTRONICS VFD PU02L VARIABLE FREQUENCY DRIVE CONTROL PAD CONTROLLER
NEW DELTA ELECTRONICS VFD PU02L VARIABLE FREQUENCY DRIVE CONTROL PAD CONTROLLER
Paypal   US $89.99
Motor Control 20 Ohm 25W Watt Rotary Variable Resistor Rheostat
Motor Control 20 Ohm 25W Watt Rotary Variable Resistor Rheostat
Paypal   US $9.59
VARIABLE SPEED CONTROL PACKAGE FOR MYFORD SUPER 7 240V
VARIABLE SPEED CONTROL PACKAGE FOR MYFORD SUPER 7 240V
Paypal   US $722.34
AC 220V 25W Power Single Phase Stepless Variable Speed Control Motor
AC 220V 25W Power Single Phase Stepless Variable Speed Control Motor
Paypal   US $83.21
Suncourt VS200 Plug In Variable Speed Fan Controller
Suncourt VS200 Plug In Variable Speed Fan Controller
Paypal   US $30.88

Variable Control

Methods Over Loading (Polymorphism)and access controls in java

Over Loading Methods and Access Controls

 

One of the OOP's, strength is polymorphism. Polymorphism can be implemented (achieved) in two ways

1.  1.      Overloading Methods

2.  2.      Overriding Methods will be discussed, in the Inheritance session.(session 4)

  Overloading Methods

  • When two or more methods in the same class share the same name, with either different parameter signatures or difference in  number of parameters, the methods are said to be over loaded, and the process is referred  to as method overloading.
  • When java encounters a call to an over loaded method , java uses the type and/ or number of arguments as its guide to determine which version of the overloaded method to actually call.
  • The method over loading does not depend on return types.

 

  /* consider the example below */

  class OverLoad

 {

           void test()

              {

                System.out.println("No parameters");

              }

              void test(int x)

              {

                System.out.println("x:  "+x);

              }

 

  /*

int test(int x)   // wrong ,as over loading does not depend on return types

{                     //since void test(int x) already exists

    return x;

}

*/

 

 int test(int x,int y)

 {

   return x+y;

 }

 double test(double x)

 {

   return x*x;

 }

 

 }

 

     class OverLoadDemo

    {

             public static void main()

            {

             OverLoad obj = new OverLoad();

             obj.test();

             obj.test(2);

             System.out.println("int test(int x,int y) method called  " + obj.test(2,3));

             System.out.println("double test(int x) method called  " + obj.test(2.00));

            }

 

     }

 

Explanation:

 When an overloaded method is called, java looks for a match between the arguments used to call the method and method's parameter. However, this match need not always be exact.In some cases' java's automatic type conversion can play a role in method overload resolution, as shown in the below example.

/* */

 

class OverLoad

 {

              void test()

              {

                System.out.println("No parameters");

              }

              double test(double x)

              {

                return x;

              }

 }

 class OverLoadDemo1

    {

             public static void main(String args[])

            {

             OverLoad obj = new OverLoad();

             obj.test();

              System.out.println("when a integer is passed then also test(double x)  method is called  " +    

             obj.test(2)); //obj.test(2) will invoke test(double x) method

             System.out.println("when a fraction number is called then also test(double x) method is called  "  

             +obj.test(2.340)); // obj.test(2.340) will invoke test(double x) method

           }

     }

 Explanation: In the above example method test(int) is not defined,since there is no matching method found, when test() is called with an integer argument, java elevates, to double and then calls test(double), of course if at all test(int) had been defined, it would have been called.

java will employ its automatic type conversions only if no exact match is found.

 Over Loading Constructors

As we overload methods, so is with constructors. We can also over load constructor methods.

lets justify the said, So far we have been passing three parameters to the Box constructor, for every new Box (object) created. What if we wanted to initialize a cube? What if we wanted to create an object which did not care, to what its initial dimensions were? The solution is simple, over load the Box Constructor.

 Consider the previous example

class Box

  {

            double width;

            double height;

            double length;

      Box(double length,double width,double height)

     {

             this.width = width;

             this.height = height;

             this.length = length;

     }

  }

 

   class BoxDemo8

  {

            public static void main(String args[])

            {

              Box MyBox = new Box(23.33,33.33,43.33);

              Box ob = new Box(); //this is illegal, since Box() requires three arguments,its an error to call it  

              //with out them.

              System.out.println("length of MyBox object is "+ MyBox.length);

              System.out.println("length of MyBox object is "+MyBox.height);

              System.out.println("length of MyBox object is "+MyBox.width);

            }          

 }

 

/* The draw back in above program can be over come by over loading constructors */

 class Box

 {

         double width,height,depth;  

           Box()

              {

                 width = -1; // use –1 to indicate an unitialized box

                 height = -1;

                 depth = -1; 

              }

              Box(double side)

              {

                 this.width = side;

                 this.height = side;

                 this.depth = side; 

              }

           Box(double width,double height,double depth)

              {

                 this.width = width;

                 this.height = height;

                 this.depth = depth; 

              }

              double volume()

              {

                return (width*height*depth);

              }

 }

     class OverLoadCons

    {

             public static void main(String args[])

            {

             Box MyBox1 = new Box();

             Box MyBox2 = new Box(23.45);

             Box MyBox3 = new Box(23.33,33.33,43.33);

             System.out.println("volume of MyBox1  " + MyBox1.volume());

             System.out.println("volume of MyBox2  " + MyBox2.volume());

             System.out.println("volume of MyBox3  " + MyBox3.volume());

            }

     }

 

 Passing  Objects as parameters

So far we have seen simple types(int,double) as parameters, However objects' can be passed, as parameters' to methods.

The example below illustrates

 

// simple program taking objects as parameters

  class Test

 {

         int i,j;     

               Test()

              {

                i = -1;//-1 indicates that values are

                j = -1;//not constructed at the time of object creation

           

              }

             Test(int x,int y)

              {

                i = x;

                j = y;

              }

           Test(Test obj)

              {

            i  = obj.i;

            j  = obj.j;

              }

          boolean equals(Test obj)

              {         

           if(i == obj.i && j == obj.j)

           return true;

           return false;

              }

  }

     class PassOb

    {

 

        public static void main(String args[])

            {

             Test MyTest1 = new Test(100,22);

             Test MyTest2 = new Test(100,22);

            Test MyTest3 = new Test(MyTest1);

             System.out.println("MyTest1 = MyTest2 : "+MyTest1.equals(MyTest2) );

             System.out.println();

             System.out.println();

             System.out.println();

             System.out.println("MyTest3 = MyTest1 : "+MyTest1.equals(MyTest3) );

            }

    }

 

/* Program below takes Box object as parameter */

class Box

 {

           double width,height,depth;

             Box()

              {

                width = -1;

               height = -1;

               depth = -1; 

              }

              Box(double width,double height,double depth)

              {

                this.width = width;

               this.height = height;

               this.depth = depth; 

              }

             Box(Box obj)

              {

              width  = obj.width;

              height = obj.height;

              depth  = obj.depth;

                }

              boolean equals(Box obj)

              {         

               if(width == obj.width && height == obj.height && depth == obj.depth)

               return true;

               return false;

              }

              double volume()

              {

                return (width*height*depth);

              }

 }

 class PassObj

 {

            public static void main(String args[])

            {

             Box MyBox1 = new Box(23.33,33.33,43.33);

             Box MyBox2 = new Box(33.33,43.33,53.33);

            Box MyBox3 = new Box(MyBox1);

            Box MyBox4 = new Box(MyBox2);

            System.out.println(" MyBox1 = MyBox3: "+ MyBox1.equals(MyBox3) +" and volumes are " + 

                                             MyBox3.volume());

             System.out.println();

             System.out.println();

             System.out.println("MyBox2 = MyBox4 : " + MyBox2.equals(MyBox4) +" volume= "+

                                            MyBox4.volume());

            }

    }

A Closer Look At Argument Passing

There are two ways of passing arguments to a subroutine(function).

1.Call By Value

2.Call By Reference

1. Call By Value:  In this approach  the value of an argument, is copied  into the formal parameter of the subroutine (function)., there by any changes made to the parameter of the subroutine, has no effect on the value of the argument

2.Call By reference : In this approach  the reference of an argument(not value of the argument), is passed  to the formal parameter of the subroutine (function)., there by any changes made to the parameter of the subroutine, Inside the subroutine, this reference is used to access the actual argument specified in the call. This means that changes, made to the parameter of the subroutine, will affect, the value of the argument used to call the subroutine.

 

Java uses both approaches, depending up on what is passed, whether it's a simple type or object.

 

  • If a   simple type, then Call By Value approach is used.
  • If an object type, then Call By Reference approach is used.

 

Let's examine each approach with the help of examples

 // Simple Types are passed by value

 class Test

{

  void meth(int i, int j)

  {

    i *= 2;

    j /= 2;

  }

}

 class CallByValue

{

  public static void main(String args[])

  {

    Test MyTest = new Test();

    int x =15,y = 20;

    System.out.println();

    System.out.println();

    System.out.println("values of x and y before call to meth() function made");

    System.out.println("x = "+x+"y = "+y);

     System.out.println();

     System.out.println("values of x and y after call to meth() function made");

     System.out.println("x = "+x+"y = "+y);

 }

}

 

Explanation: as You can see the operations occurred in meth() funtion have, no effect on the value of x and y,used in the call,Thus their values did not change to 30 and 10.

But when ever we pass an object to a method, the situation changes dramatically, objects are passed by reference. changes made to the object in the subroutine (function), do affect the object used as an argument.

when creating a variable of class type,we are actually creating a reference to an object.So when objects are passed as arguments to a method, the parameter that receives, will actually receive the reference of the same object ,which is referenced by the argumenth,Hence objects  are passed by use of reference.

 // Objects are passed by reference

class Test

{

  int i,j;

  Test(int i,int j)

  {

    this.i = i;

    this.j = j;

  }

   void meth(Test obj)

  {

   obj.i*=2;

   obj.j/=2;

  } 

 }

 class CallByRef

{

  public static void main(String args[])

  {

    Test MyTest1 = new Test(15,20);

System.out.println("values of i  and j, in MYTest1,before call to meth() function made");

System.out.println("i = "+MyTest1.i+"j = "+MyTest1.j);

MyTest1.meth(MyTest1);

System.out.println();

System.out.println();

System.out.println("values of i and j in MyTest1,after call to meth() function made");

System.out.println("i = "+MyTest1.i+"j = "+MyTest1.i);

  }

}

Remember: Simple types are passed to subroutine by CallByValue and Objects are passed by use of Call By Reference.

Returning Objects

So far we had methods returning primary type data but a method is also capable of returning class types,that we create(ie objects).

the example below, best illustrates

 //returning class types ie returning objects

 class Test

{

  int i,j;

  Test(int i,int j)

  {

    this.i = i;

    this.j = j;

}

   Test meth(Test obj)

  {

   obj.i*=2;

   obj.j/=2;

   return obj;

  } 

 }

 class RetObj

{

  public static void main(String args[])

  {

    Test MyTest1 = new Test(15,20);

    Test MyTest2;

    System.out.println("values of i  and j, in MYTest1,before call to meth() function made");

   System.out.println("i = "+MyTest1.i+"j = "+MyTest1.j);

   MyTest2 = MyTest1.meth(MyTest1);

   System.out.println();

   System.out.println();

   System.out.println("values of i and j in MyTest2,after call to meth() function made");

   System.out.println("i = "+MyTest2.i+"j = "+MyTest2.i);

  }

}

 // consider this example

class Test

{

  int a;

  Test(int i)

  {

    a = i;

   }

 

  Test IncrByTen()

  {

   Test temp = new Test(a+10);  

   return temp;

  } 

 }

 class RetObj1

{

  public static void main(String args[])

  {

    Test ob1 = new Test(2);

    Test ob2;

    ob2 = ob1.IncrByTen();

    System.out.println("value in variable a before call to Test IncrByTen() method");

    System.out.println("value of a = "+ob1.a);

    System.out.println("value in variable a after call to Test IncrByTen() method");

    System.out.println(""+ob2.a);

  }

}

 Explanation : The preceding program makes another important point, since all objects are dynamically allocated using "new", You need not worry about an object going out of scope because the method in which it was created terminates .The object will continue to exist as long as there is reference to it some where in the program.

 Recursion : is the process of defining something it terms of itself.

 Java supports recursion.

In java programming, recursion is the attribute that allows a method to call it self.

A method that call's itself is said to be recursive.

 // A simple example of recursion

 class Factorial

{

  int fact(int n)

      {

        int result=1;

           if (n == 1)

          return 1;

        else

        {

          result = fact(n-1) * n;

          return result;

        } 

       }       

}

 class RecursionDemo

{

  public static void main(String args[])

  {

    Factorial f = new Factorial();

    System.out.println();

    System.out.println("factorial of 4 is : "+f.fact(4));

    System.out.println();

    System.out.println("factorial of 10 is : "+f.fact(10));

    System.out.println();

    System.out.println("factorial of 9 is : "+f.fact(9));

    System.out.println();

    System.out.println("factorial of 8 is : "+f.fact(8));

  }

}

 Explanation : here how it works : when fact() is called with an argument of 4, the first call to fact() will cause a second call to be made with the argument of 3.This second call will cause fact(), be called third

time with an argument of 2.This Third call will cause fact(), be called fourth time with an argument 1.This will return 1.

Now 1 (The value of n in 4th  call to fact() )is multiplied with 2 (The value of n in 3rd call) and again the product, is multiplied with 3(The value of n in 2nd call to fact() )  and the product is again multiplied by 4 (The value of n in 1st  call of fact()).

 Remember : While writing recursive methods, you must have an if satement some where to force method to return with out recursive call, being executed. If if statement is not used then, once you call the method, it  will never return. This is a very common error in working with recursion.

 // Another example that uses recursion.

 class RecTest

{

  int values[];

       RecTest(int i)

      {

         values = new int[i];

      }       

//display array recursively

       void PrintArray(int i)

      {

         if (i == 0)

               return;//return o;

         else

               PrintArray(i-1);

System.out.println("["+(i-1)+"]   "+values[i-1]);

             

      }

}

 class RecursionDemo1

{

  public static void main(String args[])

  {

    RecTest ob = new RecTest(10);

     for(int i=0;i<10;i++ )

    ob.values[i]=i;

     ob.PrintArray(10);

  }

}

Introducing Access Control

Access Control: Encapsulation links data with code that manipulates it, However, Encapsulation also provides another important attribute access control.

Using access control, we can prevent misuse of the data, Thus when correctly implemented, a class creates a "black box" which may be used, but the inner workings are not open to tampering.

So access control can be implemented with the help of the following, set of access specifiers',

So how a member can be accessed is determined by one, these access specifiers' which are specified while declaration of the,members.

1)protected Applies only when inheritance is used, suppose in a package a method of a class is declared as protected then within the same package it can be accessed but if the same method is to be accessed with in another package then the class containing that method should be first inherited and then the inheriting class object can access the protected method.

2)public When a member of a class is modified by the public specifier, then that member can be accessed from any where with in the entire environment. for example main() method (which has public as access specifier).

 3)private When a member of a class is specified as private, then that member can be accessed, only other members of its class.(that's why main() is specified as public, so that it can be called from any where, by the java runtime system environment).

 4)default When no access specifier is used, then by default the member of  a class is public, with in its own package.

 so far in the programs, all the members of a class have used default access mode. which are public, with in its own package.

 syntax:

AccessSpecifier  type [ VariableName or MethodName ] ;

 for example

 private int x; public double y;

 private int MyMethod(ParameterList)

{

  // statements;

}

 /*

 This program demonstrates the difference between public and private

*/

 class Test

{

     int a; // default access

     public  int b;//public access

     private int c;//private access

 //   methods to access

     void Setc(int i)

    {

      c = i;

    }

    int getc()

    {

     return c;

    }

}

 class AccessTest

{

  public static void main(String args[])

  {

    Test ob = new Test();

    ob.a = 10; //This is ok,'a' variable can be accessed directly by object.

    ob.b = 20; //This is ok,'b' variable can be accessed directly by object.

    ob.c = 100; /* Error,as 'c' variable can not be accessed directly by object,because    

                    access is private,so it has to be accessed through methods of a class   

                   as shown below */

    ob.Setc(100) ;//This is ok

    System.out.println("value of a = "+ob.a); /* This is ok, variable can be accessed       

                                                 directly by object. */

    System.out.println("value of b = "+ob.b);/* This is ok variable can be accessed directly

                                                by object.*/

     System.out.println("value of c = "+ob.c);/*  Error,as 'c' variable can not be accessed 

                                                  directly by object but can be accessed as 

                                                  shown below with method getc()  */

 

    System.out.println("value of c = "+ob.getc());                                         

   }

}

 To see how the access control can be applied to more practical example, consider the previous stack program.

 // program TestStack.java revisited and observe the changes made with prevoius

  /*       A simple program demonstrating the ability to use classes     */

   class stack

  {

   private  int stack[] = new int[10];

   private int tos;

     stack()

     {

     tos = -1;

     }

       void push(int item)

     {

     stack[++tos] = item;

     }

      int pop()

     {

      return (stack[tos--]);

     }

      int pop(int count)

     {

      return (stack[count]);

     }

  }

   class TestStack

  {

            public static void main(String args[])

            {

          stack MyStack = new stack();

          //Fill the stack with items using for loop

          for(int i = 1; i<=10 ; i++)

          MyStack.push(i);

           System.out.println("items as entered in the stack last in last out");

          for (int i = 0 ;i<10 ;i++)

          System.out.println("value in stack " + MyStack.pop());

           MyStack.stack[5] = 100; /*   Error ,as  Tampering of the data is not possible,as object   

                                                         cannot access stack[5] directly, specified is private */

           System.out.println(" item  in stack[5] is = " + MyStack[5]); /*  Error ,as  Tampering of the data is

                                                                                                          not possible,as object cannot access 

                                                                                                          stack[5] directly ,since access 

                                                                                                           specified is private  */

             }          

  }

 Remember: In real world instance variables' (member variables of a class), are allowed to be accessed only through code (member functions of class), that is, method.

 

 

About the Author

The author is a trainer and developer in oracle and java technogies. you can reach him on raju.allu@yahoo.com


Precision 2000 Variable Control


Precision 2000 Variable Control


$34.95


Get more out of your Precision 2000 Saw with this Variable Control add-on. The rheostat-style switch makes it easy to adjust the speed of your saw from slow to full-speed or anywhere in-between with the turn of a dial. Installs easily; just plug the Variable Control into the Precision 2000 Saw, then plug the power supply cord into the Variable Control for superior performance when cutting any material.

SCVS Variable Speed


SCVS Variable Speed


$68.4


Variable Speed Control

72V Electronic Variable Speed Control


72V Electronic Variable Speed Control


$40


This stylish variable speed fan control fits in a single gang box and comes inivory to look great in any room

72W Electronic Variable Speed Control


72W Electronic Variable Speed Control


$45


This stylish variable speed fan control fits in a single gang box and comes in white to look great in any room

Electric Fan Variable Speed Control Module


Electric Fan Variable Speed Control Module


$72.99


Electric Fan Variable Speed Control Module; Replacement For PN[110/210/130/230/310/325/575];

CAD Remote Variable Pattern Control Box


CAD Remote Variable Pattern Control Box


$329.99


Remote variable pattern control box for the 1600VP, 1700VP & 220VP microphones

Variable Speed Control by Flex-a-lite for Jeep


Variable Speed Control by Flex-a-lite for Jeep


$140.99


Allows greater control over engine temperature;Reduces charging spikes and current load on charging system;Directs fan to run for 30 seconds after vehicle is turned off Variable Speed Control by Flex-a-lite for Jeep

Rapco Horizon CVPBLOX Variable Pad Microphone Volume Control


Rapco Horizon CVPBLOX Variable Pad Microphone Volume Control


$49.99


Rapco Horizon CVPBLOX Variable Pad Microphone Volume Control

Rapco Horizon Cvpblox Variable Pad Microphone Volume Control


Rapco Horizon Cvpblox Variable Pad Microphone Volume Control


$49.99


Rapco Horizon CVPBLOX Variable Pad Microphone Volume Control

Variable Speed Control by Flex-a-lite


Variable Speed Control by Flex-a-lite


$140.99


Allows greater control over engine temperature;Reduces charging spikes and current load on charging system;Directs fan to run for 30 seconds after vehicle is turned off

B440-KT Blower Economy with Variable Speed and Thermostatic


B440-KT Blower Economy with Variable Speed and Thermostatic


$125.1


B440-KT Blower Economy with Variable Speed and Thermostatic Control

GS66 Fan Kit with Variable Speed and Thermostatic Control for GD19 Model Fireplace


GS66 Fan Kit with Variable Speed and Thermostatic Control for GD19 Model Fireplace


$116.1


Napoleon GS66 Fan Kit with Variable Speed and Thermostatic Control for GD19 Model Fireplace Systems

The Speedster Variable Fan Speed Control: J


The Speedster Variable Fan Speed Control: J


$23.76


The Speedsterâ„¢is great multi purpose speed control. Three settings include off, on (full) and variable. Simple use the dial to increase or decrease fan motor speed. 120 volt/15 amps. No hard wiring required. Just plug the fan into the Speedster and adjust the fan speed settings with dial. Warranted for 90 days for use with brush type motors only, but actually works well with all fan motors. 120 volt 15 amp maximum Replaceable 15 amp fuse

SBI AC05520 100 CFM Blower with Variable Speed Control


SBI AC05520 100 CFM Blower with Variable Speed Control


$212.04


Blower with variable speed control fits on most Drolet models manufactured prior to 2001. Satisfaction ensured. Made from the finest materials.

Variable Structure Systems


Variable Structure Systems


$130


Variable structure systems (or sliding mode control systems) are nonlinear automatic control systems whose structures are deliberately allowed to change, so that robust performance is obtained. This allows the design of high performance control systems that can be reliably and easily implemented at low cost. This book is unique in that it aims to fulfil the definite need for an accessible book on variable structure systems and also provides the very latest results in research on this topic. Divided into three parts - basics of slidng mode control, new trends in sliding mode control, and applications of sliding mode control - the book contains many numerical design examples, so that the readers can quickly understand the design methodologies and their applications to practical problems.

DFAFM24-RE-N-B Hearth Kit with Variable Remote Control for 24 Double Face FireGlitter or FireLine - Natural Gas in


DFAFM24-RE-N-B Hearth Kit with Variable Remote Control for 24 Double Face FireGlitter or FireLine - Natural Gas in


$715.5


Hearth Kit with Variable Remote Control for 24 Double Face FireGlitter or FireLine

AFM24-RE-P-B Hearth Kit with Variable Remote Control for 24 FireGlitter or FireLine - Propane in


AFM24-RE-P-B Hearth Kit with Variable Remote Control for 24 FireGlitter or FireLine - Propane in


$693


Hearth Kit with Variable Remote Control for 24 FireGlitter or FireLine

AFM24-RE-N-B Hearth Kit with Variable Remote Control for 24 FireGlitter or FireLine - Natural Gas in


AFM24-RE-N-B Hearth Kit with Variable Remote Control for 24 FireGlitter or FireLine - Natural Gas in


$693


Hearth Kit with Variable Remote Control for 24 FireGlitter or FireLine

DFAFM20-RE-P-B Hearth Kit with Variable Remote Control for 20 Double Face FireGlitter or FireLine - Propane in


DFAFM20-RE-P-B Hearth Kit with Variable Remote Control for 20 Double Face FireGlitter or FireLine - Propane in


$666


Hearth Kit with Variable Remote Control for 20 Double Face FireGlitter or FireLine

DFAFM20-RE-N-B Hearth Kit with Variable Remote Control for 20 Double Face FireGlitter or FireLine - Natural Gas in


DFAFM20-RE-N-B Hearth Kit with Variable Remote Control for 20 Double Face FireGlitter or FireLine - Natural Gas in


$666


Hearth Kit with Variable Remote Control for 20 Double Face FireGlitter or FireLine

AFM20-RE-P-B Hearth Kit with Variable Remote Control for 20 FireGlitter or FireLine - Propane in


AFM20-RE-P-B Hearth Kit with Variable Remote Control for 20 FireGlitter or FireLine - Propane in


$648


Hearth Kit with Variable Remote Control for 20 FireGlitter or FireLine

AFM20-RE-N-B Hearth Kit with Variable Remote Control for 20 FireGlitter or FireLine - Natural Gas in


AFM20-RE-N-B Hearth Kit with Variable Remote Control for 20 FireGlitter or FireLine - Natural Gas in


$648


Hearth Kit with Variable Remote Control for 20 FireGlitter or FireLine

AFM20-RE-N-SS Hearth Kit with Variable Remote Control for 20 FireGlitter or FireLine - Natural Gas in Stainless


AFM20-RE-N-SS Hearth Kit with Variable Remote Control for 20 FireGlitter or FireLine - Natural Gas in Stainless


$810


Hearth Kit with Variable Remote Control for 20 FireGlitter or FireLine

AFM30-RE-P-B Hearth Kit with Variable Remote Control for 30 FireGlitter or FireLine - Propane in


AFM30-RE-P-B Hearth Kit with Variable Remote Control for 30 FireGlitter or FireLine - Propane in


$756


Hearth Kit with Variable Remote Control for 30 FireGlitter or FireLine

AFM30-RE-N-B Hearth Kit with Variable Remote Control for 30 FireGlitter or FireLine - Natural Gas in


AFM30-RE-N-B Hearth Kit with Variable Remote Control for 30 FireGlitter or FireLine - Natural Gas in


$756


Hearth Kit with Variable Remote Control for 30 FireGlitter or FireLine

AFM30-RE-P-SS Hearth Kit with Variable Remote Control for 30 FireGlitter or FireLine - Propane in Stainless


AFM30-RE-P-SS Hearth Kit with Variable Remote Control for 30 FireGlitter or FireLine - Propane in Stainless


$963


Hearth Kit with Variable Remote Control for 30 FireGlitter or FireLine

AFM30-RE-N-SS Hearth Kit with Variable Remote Control for 30 FireGlitter or FireLine - Natural Gas in Stainless


AFM30-RE-N-SS Hearth Kit with Variable Remote Control for 30 FireGlitter or FireLine - Natural Gas in Stainless


$963


Hearth Kit with Variable Remote Control for 30 FireGlitter or FireLine

DFAFM24-RE-P-B Hearth Kit with Variable Remote Control for 24 Double Face FireGlitter or FireLine - Propane in


DFAFM24-RE-P-B Hearth Kit with Variable Remote Control for 24 Double Face FireGlitter or FireLine - Propane in


$715.5


Hearth Kit with Variable Remote Control for 24 Double Face FireGlitter or FireLine

DFAFM30-RE-P-B Hearth Kit with Variable Remote Control for 30 Double Face FireGlitter or FireLine - Propane in


DFAFM30-RE-P-B Hearth Kit with Variable Remote Control for 30 Double Face FireGlitter or FireLine - Propane in


$783


Hearth Kit with Variable Remote Control for 30 Double Face FireGlitter or FireLine

DFAFM30-RE-N-B Hearth Kit with Variable Remote Control for 30 Double Face FireGlitter or FireLine - Natural Gas in


DFAFM30-RE-N-B Hearth Kit with Variable Remote Control for 30 Double Face FireGlitter or FireLine - Natural Gas in


$783


Hearth Kit with Variable Remote Control for 30 Double Face FireGlitter or FireLine

DFAFM24-RE-N-SS Hearth Kit with Variable Remote Control for 24 Double Face FireGlitter or FireLine - Natural Gas in Stainless


DFAFM24-RE-N-SS Hearth Kit with Variable Remote Control for 24 Double Face FireGlitter or FireLine - Natural Gas in Stainless


$913.5


Hearth Kit with Variable Remote Control for 24 Double Face FireGlitter or FireLine

AFM24-RE-P-SS Hearth Kit with Variable Remote Control for 24 FireGlitter or FireLine - Propane in Stainless


AFM24-RE-P-SS Hearth Kit with Variable Remote Control for 24 FireGlitter or FireLine - Propane in Stainless


$873


Hearth Kit with Variable Remote Control for 24 FireGlitter or FireLine

AFM24-RE-N-SS Hearth Kit with Variable Remote Control for 24 FireGlitter or FireLine - Natural Gas in Stainless


AFM24-RE-N-SS Hearth Kit with Variable Remote Control for 24 FireGlitter or FireLine - Natural Gas in Stainless


$873


Hearth Kit with Variable Remote Control for 24 FireGlitter or FireLine

DFAFM30-RE-P-SS Hearth Kit with Variable Remote Control for 30 Double Face FireGlitter or FireLine - Propane in Stainless


DFAFM30-RE-P-SS Hearth Kit with Variable Remote Control for 30 Double Face FireGlitter or FireLine - Propane in Stainless


$1008


Hearth Kit with Variable Remote Control for 30 Double Face FireGlitter or FireLine

DFAFM30-RE-N-SS Hearth Kit with Variable Remote Control for 30 Double Face FireGlitter or FireLine - Natural Gas in Stainless


DFAFM30-RE-N-SS Hearth Kit with Variable Remote Control for 30 Double Face FireGlitter or FireLine - Natural Gas in Stainless


$1008


Hearth Kit with Variable Remote Control for 30 Double Face FireGlitter or FireLine

DFAFM24-RE-P-SS Hearth Kit with Variable Remote Control for 24 Double Face FireGlitter or FireLine - Propane in Stainless


DFAFM24-RE-P-SS Hearth Kit with Variable Remote Control for 24 Double Face FireGlitter or FireLine - Propane in Stainless


$913.5


Hearth Kit with Variable Remote Control for 24 Double Face FireGlitter or FireLine

DFAFM20-RE-P-SS Hearth Kit with Variable Remote Control for 20 Double Face FireGlitter or FireLine - Propane in Stainless


DFAFM20-RE-P-SS Hearth Kit with Variable Remote Control for 20 Double Face FireGlitter or FireLine - Propane in Stainless


$846


Hearth Kit with Variable Remote Control for 20 Double Face FireGlitter or FireLine

DFAFM20-RE-N-SS Hearth Kit with Variable Remote Control for 20 Double Face FireGlitter or FireLine - Natural Gas in Stainless


DFAFM20-RE-N-SS Hearth Kit with Variable Remote Control for 20 Double Face FireGlitter or FireLine - Natural Gas in Stainless


$846


Hearth Kit with Variable Remote Control for 20 Double Face FireGlitter or FireLine

Tags: , , , , , , , , ,



wordpress visitor