Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

JAVA JDK only, please show all code. Assume a program containing the driver clas

ID: 3697562 • Letter: J

Question

JAVA JDK only, please show all code.

Assume a program containing the driver class with the main method that declares two DataTypeClass objects as follows:

public class DriverClass

{

       public static void main (String[ ] args )

       {

DataTypeClass first = _________ ;        // H: calling the no-argument constructor

DataTyepClass second = __________; // I: calling the parameter constructor to pass:

                                                                    // “Jefferson Brown” and 3.5 to the object

System.out.println( first );     // J?

System.out.println( second );    // K?

// call the method staticMethod

____________________; // L ?

                      }

              }

               Write the complete lines H and I

Explanation / Answer

DataTypeClass.java:-

------------------------------

package com.app.chegg;

public class DataTypeClass {
   String name;
   double height;
   public DataTypeClass(String name, double height) {
       super();
       this.name = name;
       this.height = height;
   }
   public DataTypeClass() {
      
   }
   static void dataTypeDetails(){
       System.out.println("This is static Method");
   }
  
  
  

}

DriverClass.java:-

-----------------------------

package com.app.chegg;

public class DriverClass {
   public static void main(String[] args) {
       DataTypeClass first=new DataTypeClass();
       DataTypeClass second=new DataTypeClass("Jefferson Brown", 3.5);
       System.out.println(first);
       System.out.println(second);
       first.dataTypeDetails();// call like this also
       second.dataTypeDetails();
       DataTypeClass.dataTypeDetails(); // static invoked directly with ClassName
   }

}

Output :-

--------------

com.app.chegg.DataTypeClass@1930ebb
com.app.chegg.DataTypeClass@1ac1adf
This is static Method
This is static Method
This is static Method