Please enable JavaScript to use CodeHS

Want to receive Question of the Day updates? Subscribe Here

AP CSA Question of the Day April 2, 2025

Reference
  1. Incorrect Correct No Answer was selected Invalid Answer

    Given an instance of the Song class called song, what is the proper way to set the length after it has been instantiated?

    public class Song
    {
      private String title;
      private String artist;
      private double length;
    
      public double getLength()
      {
        return this.length;
      }
    
      public Song(String title, String artist, double length)
      {
        this.title = title;
        this.artist = artist;
        this.length = length;
      }
    }
    Java