Answered step by step
Verified Expert Solution
Question
1 Approved Answer
what is the output of this code? 54 - class main_class{ 55 public static void main (String[Jargs) { 56 ShockAbsorber sa = new ShockAbsorber(0.5,5.5,0.8); ;
what is the output of this
code?
54 - class main_class{ 55 public static void main (String[Jargs) { 56 ShockAbsorber sa = new ShockAbsorber(0.5,5.5,0.8); ; System.out.println("Shock Absorber details'); 58 System.out.println(sa) 59 57 60 } 61 ute public class ShockAbsorber{ double pistonRodLength: double springTension; double cylinderLength; public ShockAbsorber() { pistonRodLength = 0; spring Tension = @ cylinderLength = 0; public ShockAbsorber (double pistonRodLength, double springTnsion, double cylinderLength) { this.pistonRodLength = pistonRodLength; this.spring Tension = springTension; this.cylinder Length = cylinderLength; B 0 public void setPistonRodLength(double d) { pistonRodLength = d; } public void setSpringTension(double d){ spring Tension = d; } public void setCylinderLength(double d) { cylinderLength =d; } 22 23 24- 25 26 27 28 29 - 30 31 32 33 34 35 36 - 37 38 39 - 40 41 42 43 44 45 46 47 48 49 50 51 52 public double getPistonLength() { return pistonRodLength; } public double getSpringTension() { return springTension; } public double getcylinderLength(){ return cylinderLength: } public String toString) (){ String S= 'Piston Rod Length = ' + pistonRodLength + 'mm'; 5 +=' Spring Tension =' + springTension + 'N'; 5 + ' cylinder Length Tension=' + cylinderLength + 'mm' return 5; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started