Question: Two Java SE classes are declared as shown below: public class Invoice { public static String formatId ( String oldId ) { return oldId +

Two Java SE classes are declared as shown below:
public class Invoice {
public static String formatId(String oldId){
return oldId +_Invoice;
}
}
public class SalesInvoice extends Invoice {
public static String formatId(String oldId){
return oldId +_SalesInvoice;
}
}
Which of the following statements are true about attempts to use these classes?
a. Invoice invoice = new SalesInvoice();
System.out.println(Invoice.formatId(1234));
Will output 1234_SalesInvoice
b. SalesInvoice invoice=new SalesInvoice();
System.out.println(Invoice.formatId(1234));
Will output 1234_SalesInvoice
c. Invoice invoice = new Invoice();
System.out.println(invoice.formatId(1234));
Will output 1234_Invoice
d. Invoice invoice = new Invoice();
System.out.println((SalesInvoice)Invoice.formatId(1234));
Will output 1234_SalesInvoice
e. SalesInvoice invoice= new SalesInvoice();
System.out.println(invoice.formatId(1234));
Will output 1234_Invoice

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!