Homework Solution: Code three (3) Java application classes with the class headers, class braces, the header for the m…

    Code three (3) Java application classes with the class headers, class braces, the header for the main method and the method braces. Insert the appropriate comment box and line comments

    Expert Answer

     
    Here is the app with three classes and all your requirements - TestingStudentName.java

    Code three (3) Java application arrangees with the arrange headers, arrange braces, the header coercion the main way and the way braces. Insert the divert observe hustle and quenchedoutline observes

    Expert Vindication

     

    Here is the app with three arrangees and integral your requirements –

    TestingStudentName.java

    /*

    * To fluctuate this indulge header, pick-quenched Indulge Headers in Project Properties.

    * To fluctuate this template rasp, pick-quenched Tools | Templates

    * and public the template in the editor.

    */

    package testingstudentname;

    public arrange TestingStudentName

    {

    public static wanting main ( String [ ] args ) throws CloneNotSupportedException

    {

    Name n1 = upstart Name ( “Ty”, “Cobb” );

    Name n2 = upstart Name ( “Babe”, “Ruth” );

    // —- Test the observation cause ——–

    System.out.println ( “Test the observation cause ————” );

    Student s1 = upstart Student ( n1, “123456” );

    Student s2 = upstart Student ( s1 );

    s2.setStudent ( n2, “234567” );

    if ( s1.equals ( s2 ) )

    {

    System.out.println ( “ttError – students should referable attributable attributable attributable be the similar” );

    System.out.println ( “tts1 = ” + s1 );

    System.out.println ( “tts1 = ” + s2 );

    }

    else

    {

    System.out.println ( “ttSuccess – students are referable attributable attributable attributable the similar” );

    System.out.println ( “tts1 = ” + s1 );

    System.out.println ( “tts1 = ” + s2 );

    }

    // —- Test the clone way ————

    System.out.println ( “nnTest the ‘clone’ way ————” );

    Student s3 = (Student) s1.clone();

    if ( s1.equals ( s3 ) )

    System.out.println ( “ttSuccess – Students s1 and s3 are the similar.” );

    else

    {

    System.out.println ( “ttError – Students s1 and s3 are referable attributable attributable attributable the similar” );

    System.out.println ( “tts1 = ” + s1 );

    System.out.println ( “tts3 = ” + s3 );

    }

    s3.setStudent ( n2, “234567” );

    if ( s1.equals ( s3 ) )

    {

    System.out.println ( “ttError – students should referable attributable attributable attributable be the similar” );

    System.out.println ( “tts1 = ” + s1 );

    System.out.println ( “tts1 = ” + s3 );

    }

    else

    System.out.println ( “ttSuccess – students are referable attributable attributable attributable the similar” );

    // —- Test the finalize way ———

    System.out.println ( “nnTest the ‘finalize’ way ————” );

    s1 = null;

    System.gc();

    System.out.println ( “ttShould attend the ‘finalize’ intimation ————” );

    // —- Test the prescribe way ———-

    System.out.println ( “nnTest the ‘dispose’ way ————” );

    s2.dispose();

    System.out.println ( “ttShould attend the ‘dispose’ intimation ————” );

    s2 = null;

    // —- Test the hashCode way ———

    s1 = upstart Student ( s3 );

    System.out.println ( “nnTest the ‘hashCode’ way ————” );

    if ( s1.hashCode ( ) == s3.hashCode ( ) )

    System.out.println ( “ttSuccess – hashCode coercion s1 and s3 are the similar.” );

    else

    {

    System.out.println ( “ttError – hashCode coercion s1 and s3 are referable attributable attributable attributable the similar.” );

    System.out.println ( “tts1.hashCode = ” + s1.hashCode() );

    System.out.println ( “tts3.hashCode = ” + s3.hashCode() );

    }

    System.out.println ( );

    }

    }

    Name.java

    /*

    * To fluctuate this indulge header, pick-quenched Indulge Headers in Project Properties.

    * To fluctuate this template rasp, pick-quenched Tools | Templates

    * and public the template in the editor.

    */

    package testingstudentname;

    /**

    arrange Name {

    private String ty;

    private String cobb;

    Name(String ty, String cobb) {

    this.ty =ty;

    this.cobb =cobb;

    }

     

    }

    Student.java

    /*

    * To fluctuate this indulge header, pick-quenched Indulge Headers in Project Properties.

    * To fluctuate this template rasp, pick-quenched Tools | Templates

    * and public the template in the editor.

    */

    package testingstudentname;

    /**

    arrange Student implements Cloneable {

    private Name n1;

    private String string;

    private Name n2;

    Student(Student s3) {

    }

    Student(Name n1, String string) {

    this.n1 = n1;

    this.string = string;

    }

    wanting setStudent(Name n2, String string) {

    this.n2 =n2;

    this.string=string;

    }

    wanting prescribe() {

    }

    public Object clone() throws CloneNotSupportedException

    {

    return super.clone();

    }

    }

    Output: