Accenture Primer
Accenture DumpmediumAccenture PrimerAccenture-Primer-Dump

Accenture Accenture Primer Practice Question

Predict the output startprogram class Product { String productName; } class Mobile extends Product { String mobileName; void display() { super.productName = mobileName + “Brand New !”; System.out.println(mobileName +” “ + productName); } } class Main { public Static void main(String args[]) { Mobile obj = new Mobile(); obj.productName=”1”; obj.mobileName=”2”; obj.display(); } } endprogram

Answer options

A
2 2Brand New !
B
1 2Brand New !
C
1 1Brand New !
D
Brand New !

Correct answer: 2 2Brand New !

Explanation

In display(): super.productName = mobileName + 'Brand New !' = '2Brand New !'. Then System.out.println(mobileName + ' ' + productName) prints '2 2Brand New !' because productName now holds '2Brand New !'.

Related Accenture Accenture Primer questions

Practice more Accenture Accenture Primer questions

PrimerDumps has 1400+ primer questions, 2026 mocks and coding hands-on — all free.