Java Programming
Accenture Technical PrimermediumJava Programming03 Class And Objects, Date Api

Accenture Java Programming Practice Question

Observe the below class. class Product{ int productId; String productName; Product { productId=0; productName= ; } Product(int id, String name) { //access Product() ---- Line 1 productId=id; productName=name; } } Identify the valid option which is used to invoke the no argument constructor, Product(), at Line 1.

Answer options

A
this()
B
Product()
C
super()
D
new Product()

Correct answer: this()

Explanation

Quick AnswerThe correct answer is this() because it directly addresses the core logic of Java Programming.

this() calls the no-argument constructor of the same class within a constructor.

Related Accenture Java Programming questions

Practice more Accenture Java Programming questions

PrimerPrep has 1400+ practice questions, 2026 simulations and coding hands-on — all free.

Watch Walkthroughs!