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: 3697565 • 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

Question3:

What is the output at the line J and K?

Question4:

Write the code on line L

Explanation / Answer

DriverClass.java

class DataTypeClass
{
    String str1;//variables str1 and f11
    float f11;

    public float getF1() {//getter and setter methods to get and set str and f values
        return f11;
    }

    public void setF1(float f1) {//getter and setter methods to get and set str and f values
        this.f11 = f11;
    }

    public String getStr() {//getter and setter methods to get and set str and f values
        return str1;
    }

    public void setStr(String str) {//getter and setter methods to get and set str and f values
        this.str1 = str;
    }
     DataTypeClass()
     {//constructor with out argument
         System.out.println("this is constructor without argument");
     }
     DataTypeClass(String str,float f1)
     {//constructor with arguments
        str1=str;

        f11=f1;
      

     }
}
public class DriverClass

{

       public static void main (String[ ] args )

       {

DataTypeClass first =new DataTypeClass();        // H: calling the no-argument constructor

DataTypeClass second =new DataTypeClass("Jefferson Brown",(float) 3.5); // 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

staticmethod(); // L ?

                      }
       public static void staticmethod()
    {
           System.out.println("this is static method");
       }

              }

output

this is constructor without argument
Jefferson Brown
3.5
DataTypeClass@19821f
DataTypeClass@addbf1
this is static method