Home » Interview » Technology

How to call argument constructor?

Correct Answer: new ClassName( arg1, arg2, argN); Ex: Class sample { Sample(int a) { Systemoutprintln("arg con a =" +a); } } class Demo { Public static void main( String[] args) { Sample s1= new Sample(23); Sample s2= new Sample(45); } }

← Previous Question Next Question→

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion