Consider the following class:
Public class Auto
{
Private String make;
Private String model;
Private String year;
Public Auto(String aMake, String aModel, String aYear)
{
Make = aMake;
Model = aModel;
Year = aYear;
}
Public String getInfo()
{
Return year + " " + make + " " + model;
}
}
Which of the following code snippets will correctly create an object of this class and display its information?
A) myAuto = new Auto() ;
System.out.println(myAuto.getInfo() ) ;
B) Auto myAuto = new Auto() ;
System.out.println(myAuto.getInfo() ) ;
C) Auto myAuto = new Auto("Ford", "Focus", "2011") ;
System.out.println(myAuto.getInfo() ) ;
D) Auto myAuto = new Auto("2011", "Ford", "Focus") ;
System.out.println(myAuto.getInfo() ) ;
Correct Answer:
Verified
Q69: Consider the following code snippet:
Public class Vehicle
{
Private
Q70: Insert the missing code in the following
Q71: You have created a ShoppingCart class and
Q72: Consider the following code snippet:
Public class Vehicle
{
Private
Q73: Which of the following statements using data
Q75: Insert the missing code in the following
Q76: Consider the following code snippet:
Public class Employee
{
Private
Q77: You have created a Coin class and
Q78: Insert the missing code in the following
Q79: Consider the following code snippet:
Public class BankAccount
{
Private
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents