please help me java 1Write a single statment that declares a

please help me java

1.Write a single statment that declares a reference variable of type Elevator named myLift and instantiates an object of type Elevator, passing an initial int value of 22 to the constructor of class for its initial floor.

2.Assume a class named Logger has a public static method, printErrorDescription , that accepts one int argument and returns an int value. Write a single statintment that invokes the method printErrorDescription , passing it the value 14, and returning a value back to the int variable exitcode.

Solution


1.
   To create an object, you need to use \'new\' keyword and proper constructor of that class
   Elevator myLift = new Elevator(22);

2.
   To call static method, we do not need to create a object of that class. We can call all static members using class name.
int exitcode = Logger.printErrorDescription(14);

please help me java 1.Write a single statment that declares a reference variable of type Elevator named myLift and instantiates an object of type Elevator, pass

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site